Pacemaker常用命令

crm configure show #查看配置信息

 说明:

资源组名为zavipg,包含有zatest和vip01两个资源。

vip为10.10.206.229,通过systemd监控zabbix_agentd服务,监控周期为3s,超时时间为15s,失败后置为状态standby;

通过location配置资源约束,首选运行节点为centos20624,通过#uname识别

 

pcs status #查看群集信息及状态

pcs resource show #查看所有资源

pcs resource show zatest #查看资源zatest

pcs resource show vip01 #查看资源vip01

pcs resource failcount show zatest #停止zabbix_agentd后,查看资源zatest的失败次数为1

pcs resource cleanup zatest --node centos20624 --strict #清除节点centos20624上的资源zatest的失败状态

pcs resource cleanup zatest --node centos20624#因为zatest与vip01位于同一个group下,所以该命令会清除节点centos20624上的资源zatest和vip01的失败状态

 

当节点20624上的zabbix_agentd停止后,vip会漂移到节点20627上,重新启动20624节点上的zabbix_agentd,vip不会自动漂移回来,因为该节点上的zatest资源状态一直是failed状态,需要先通过 pcs resource cleanup 清除失败状态,清除后,vip会自动漂移回20624节点。

当节点20624上的zabbix_agentd停止又重新启动后,如果不清除其失败计数状态,如果节点20627上的zabbix_agentd停止后,vip会在两个节点全部消失。清除2个节点的失败计数状态后,vip会自动回到节点20624上。

 

 pcs constraint list  #查看约束

 pcs constraint list --full cli-prefer-zavipg #查看特定资源cli-prefer-zavipg的约束

 通过crm configure edit,添加约束,约束名称为cli-prefer-zavipg:

location cli-prefer-zavipg zavipg \
        rule #uname eq centos20624

pcs constraint location  zavipg rule  "#uname" eq centos20624  #通过pcs constraint location添加约束,效果同上,自动生成约束的名称为location-zavipg

pcs constraint remove cli-prefer-zavipg 删除名为cli-prefer-zavipg的约束:

 

pcs property list –all  #查看所有可用资源,用于配置资源监控

pcs property set no-quorum-policy=ignore #二个节点时,忽略节点quorum功能

 

pcs resource defaults resource-stickiness=100 #为所有资源设置默认资源粘性 100

pcs resource defaults #查看当前资源默认值

pcs resource defaults resource-stickiness=  #请注意,资源组的资源粘性是根据该组中运行的资源数量计算的

pacemaker运行日志:/var/log/cluster/目录下

 

posted on 2024-04-28 10:18  momingliu11  阅读(11)  评论(0编辑  收藏  举报