第 8 章 资源问题的故障排除
如果资源失败,您必须调查问题的原因和位置,修复失败的资源,并选择性地清理资源。根据您的部署,资源失败的原因有很多,您必须调查资源来确定如何解决这个问题。
例如,您可以检查资源限制,以确保资源不会相互中断,并且资源可以互相连接。您还可以检查比其他 Controller 节点更频繁隔离的 Controller 节点,以识别可能的通信问题。
8.1. 查看资源限制
您可以查看如何启动服务的限制,包括与每个资源所在的位置相关的限制、资源启动顺序以及资源是否必须与另一个资源共存。
查看所有资源限制
在任何 Controller 节点上,运行 pcs constraint show
命令。
$ sudo pcs constraint show
以下示例显示了 Controller 节点上的 pcs constraint show
命令中截断的输出:
Location Constraints: Resource: galera-bundle Constraint: location-galera-bundle (resource-discovery=exclusive) Rule: score=0 Expression: galera-role eq true [...] Resource: ip-192.168.24.15 Constraint: location-ip-192.168.24.15 (resource-discovery=exclusive) Rule: score=0 Expression: haproxy-role eq true [...] Resource: my-ipmilan-for-controller-0 Disabled on: overcloud-controller-0 (score:-INFINITY) Resource: my-ipmilan-for-controller-1 Disabled on: overcloud-controller-1 (score:-INFINITY) Resource: my-ipmilan-for-controller-2 Disabled on: overcloud-controller-2 (score:-INFINITY) Ordering Constraints: start ip-172.16.0.10 then start haproxy-bundle (kind:Optional) start ip-10.200.0.6 then start haproxy-bundle (kind:Optional) start ip-172.19.0.10 then start haproxy-bundle (kind:Optional) start ip-192.168.1.150 then start haproxy-bundle (kind:Optional) start ip-172.16.0.11 then start haproxy-bundle (kind:Optional) start ip-172.18.0.10 then start haproxy-bundle (kind:Optional) Colocation Constraints: ip-172.16.0.10 with haproxy-bundle (score:INFINITY) ip-172.18.0.10 with haproxy-bundle (score:INFINITY) ip-10.200.0.6 with haproxy-bundle (score:INFINITY) ip-172.19.0.10 with haproxy-bundle (score:INFINITY) ip-172.16.0.11 with haproxy-bundle (score:INFINITY) ip-192.168.1.150 with haproxy-bundle (score:INFINITY)
这个输出显示以下主要的约束类型:
- 位置约束
列出可分配资源的位置:
-
第一个约束定义了一个规则,它将 galera-bundle 资源设置为在
galera-role
属性设置为true
的节点上运行。 -
第二个位置约束指定 IP 资源 ip-192.168.24.15 仅在将
haproxy-role
属性设置为true
的节点上运行。这意味着集群将 IP 地址与haproxy
服务相关联,这是使服务可访问的必要。 - 第三个位置约束显示 ipmilan 资源在每个 Controller 节点上被禁用。
-
第一个约束定义了一个规则,它将 galera-bundle 资源设置为在
- 排序限制
列出资源可以启动的顺序。本例演示了一个约束,它将虚拟 IP 地址资源 IPaddr2 设置为在 HAProxy 服务之前启动。
注意排序限制仅适用于 IP 地址资源和 HAproxy。systemd 管理所有其他资源,因为 Compute 等服务应该出现相依服务的中断,如 Galera。
- colocation Constraints
- 列出哪些资源必须被放在一起。所有虚拟 IP 地址都链接到 haproxy-bundle 资源。
查看 Galera 位置约束
在任何 Controller 节点上,运行 pcs attribute show
命令。
$ sudo pcs property show
输出示例:
Cluster Properties: cluster-infrastructure: corosync cluster-name: tripleo_cluster dc-version: 1.1.16-12.el7_4.5-94ff4df have-watchdog: false redis_REPL_INFO: overcloud-controller-0 stonith-enabled: false Node Attributes: overcloud-controller-0: cinder-volume-role=true galera-role=true haproxy-role=true rabbitmq-role=true redis-role=true rmq-node-attr-last-known-rabbitmq=rabbit@overcloud-controller-0 overcloud-controller-1: cinder-volume-role=true galera-role=true haproxy-role=true rabbitmq-role=true redis-role=true rmq-node-attr-last-known-rabbitmq=rabbit@overcloud-controller-1 overcloud-controller-2: cinder-volume-role=true galera-role=true haproxy-role=true rabbitmq-role=true redis-role=true rmq-node-attr-last-known-rabbitmq=rabbit@overcloud-controller-2
在此输出中,您可以验证所有 Controller 节点的 galera-role
属性是否为 true
。这意味着 galera-bundle 资源仅在这些节点上运行。同样的概念适用于与其他位置限制关联的其他属性。