在使用pacemaker维护的集群时,经常使用pcs 命令查询集群的状态,如:
pcs status 查询集群下各主机的状态
Cluster name: 111
Last updated: Tue Mar 8 10:37:39 2016
Last change: Mon Mar 7 14:22:04 2016 via crmd on cvm1457070021
Stack: corosync
Current DC: xxxxxx(2) - partition with quorum
Version: 1.1.10-32.el7.centos.1-368c726
2 Nodes configured
6 Resources configured
Online: [ xxxxxxxxx xxxxxxxxx]
Full list of resources:
Clone Set: dlm-clone [dlm]
Started: [ xxxxxxxxx xxxxxxxxx]
fence192.168.0.221 (stonith:fence_ipmilan): Started xxxxxxxxxxxxx
fence192.168.0.236 (stonith:fence_ipmilan): Started xxxxxxxxxxxxx
Clone Set: gfs2_cluster-clone [gfs2_cluster]
Started: [ xxxxxxxxx xxxxxxxxx]
PCSD Status:
192.168.x.xxx: Online
192.168.x.xxx: Online
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
资源正常时,查询结果会马上返回。但是,当网络资源紧缺或者出现延迟的时候。此命令的返回有可能超过10 seconds,但是pacemaker的校验时间低于3 seconds。如果在集群中
使用此命令维护,长时间不返回。会导致集群自动fence。
linux环境下,我们一般使用盘popen或者systemcall进行命令调用,并通过其返回值和打印值判断调用成功与否。当上述情况发生时,pclose会卡住,