1、查询Fence设备资源
# pcs stonith list ## 查看支持Fence列表
# pcs stonith describe agent_name ## 查看Fence资源使用参数,pcs stonith describe fence_vmware_soap
2、配置fence设备资源
# pcs stonith create ipmi-fencing fence_ipmilan \
pcmk_host_list="pcmk-1 pcmk-2" ipaddr="10.0.0.1" login=testuser passwd=acd123 \
op monitor interval=60s
mark:
If the device does not support the standard port parameter or may provide additional ones, you may also need to set the special pcmk_host_argument parameter. See man stonithd for details.
If the device does not know how to fence nodes based on their uname, you may also need to set the special pcmk_host_map parameter. See man stonithd for details.
If the device does not support the list command, you may also need to set the special pcmk_host_list and/or pcmk_host_check parameters. See man stonithd for details.
If the device does not expect the victim to be specified with the port parameter, you may also need to set the special pcmk_host_argument parameter. See man stonithd for details.
example: pcmk_host_argument="uuid" pcmk_host_map="node11:4;node12:5;node13:6" pcmk_host_list="node11,node12" pcmk_host_check="static-list"
3、配置VMWARE (fence_vmware_soap)
特别说明:本次实例中使用了第3项(pcs stonith create vmware-fencing fence_vmware_soap)这个指定pcmk配置参数才能正常执行Fencing动作。
3.1、确认vmware虚拟机的状态:
# fence_vmware_soap -o list -a vcenter.example.com -l cluster-admin -p -z ## 获取虚拟机UUID
# fence_vmware_soap -o status -a vcenter.example.com -l cluster-admin -p -z -U ## 查看状态
# fence_vmware_soap -o status -a vcenter.example.com -l cluster-admin -p -z -n
3.2、配置fence_vmware_soap
# pcs stonith create vmware-fencing-node11 fence_vmware_soap \
action="reboot" ipaddr="192.168.10.10" login="vmuser" passwd="vmuserpd" ssl="1" \
port="node11" shell_timeout=60s login_timeout=60s op monitor interval=90s
# pcs stonith create vmware-fencing-node11 fence_vmware_soap \
action="reboot" ipaddr="192.168.10.10" login="vmuser" passwd="vmuserpd" ssl="1" \
uuid="421dec5f-c484-3d69-ddfb-65af46530581" shell_timeout=60s login_timeout=60s op monitor interval=90s
# pcs stonith create vmware-fencing fence_vmware_soap \
action="reboot" ipaddr="192.168.10.10" login="vmuser" passwd="vmuserpd" ssl="1" \
pcmk_host_argument="uuid" pcmk_host_check="static-list" pcmk_host_list="node11,node12" \
pcmk_host_map="node11:421dec5f-c484-3d69-ddfb-65af46530581;node12:421dec5f-c484-3d69-ddfb-65af46530582" \
shell_timeout=60s login_timeout=60s op monitor interval=90s
注:如果配置fence_vmware_soap设备时用port=vm name在测试时不能识别,则使用uuid=vm uuid代替;
建议使用 pcmk_host_argument、pcmk_host_map、pcmk_host_check、pcmk_host_list 参数指明节点与设备端口关系,格式:
pcmk_host_argument="uuid" pcmk_host_map="node11:uuid4;node12:uuid5;node13:uuid6" pcmk_host_list="node11,node12,node13" pcmk_host_check="static-list"
4、配置SCSI
# ls /dev/disk/by-id/wwn-* ## 获取Fencing磁盘UUID号,磁盘须未格式化
# pcs stonith create iscsi-fencing fence_scsi \
action="reboot" devices="/dev/disk/by-id/wwn-0x600e002" meta provides=unfencing
5、配置DELL DRAC
# pcs stonith create dell-fencing-node11 fence_drac
.....
6、管理 STONITH
# pcs resource clone vmware-fencing ## clone stonith资源,供多节点启动
# pcs property set stonith-enabled=true ## 启用 stonith 组件功能
# pcs stonith cleanup vmware-fencing ## 清除Fence资源的状态与错误计数
# pcs stonith fence node11 ## fencing指定节点
7、管理tomcat
#pcs resource create tomcat ersweb statusurl=http://127.0.0.1 java_home=/usr/java/jdk1.6.0_12/ catalina_home=/usr/local/Ers/tomcat/ op monitor interval=30s