Two nodes, devr1n25/devr1n26.
# yum -y install pacemaker pcs corosync
# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf
# vim /etc/corosync/corosync.conf
# pcs cluster setup clusterName devr1n25 devr1n26
# pcs start
- Add IP resource
# pcs resource create vip ocf:heartbeat:IPaddr2 ip=172.16.1.240 cidr_netmask=16 op monitor interval=30s
- Add service resource (haproxy)
# pcs resource create haproxy lsb:haproxy op monitor interval=30s op start op stop
# pcs constraint colocation add vip haproxy INFINITY
# pcs constraint order vip then haproxy
Sometimes one node maybe powerful than the other, so we need to run the resource on the power full node.
# pcs constraint location haproxy prefers devr1n25=50
Sometimes we need to manually moving the resources, we can use this command.
# pcs constraint all
# pcs constraint location haproxy prefers devr1n25=INFINITY
# pcs constraint all
This will move the haproxy resource to devr1n25 node
Once we have finished whatever activity that required us to move the resources to devr1n25, we can then allow the cluster to resume normal operation with the unmove command. Since we previously configured a default stickiness, the resources will remain on pcmk1.
# pcs constraint all
# pcs constraint rm location-haproxy-devr1n25-INFINITY
# pcs constraint all
Edit the whole file
# cibadmin --query > tmp.xml
# vim tmp.xml
# cibadmin --replace --xml-file tmp.xml
Only edit part of the file (resources section)
# cibadmin --query --obj-type resources > tmp.xml
# vim tmp.xml
# cibadmin --replace --obj_type resources --xml-file tmp.xml
# cibadmin --modify --crm_xml '<cib admin_epoch="42"/>'
Delete part of the configuration file
# cibadmin -Q | grep stonith
# cibadmin --delete --crm_xml '<primitive id="child_DoFencing"/>'
To enable stonith
# crm_attribute --attr-name stonith-enabled --attr-value true
To see if node1 is allowed to rung resources
# crm_standby --get-value --node-uname somenode
To find the current location of resource httpd
# crm_resource --locate --resource httpd
HA just does the failover operation, we should use other tools to recover the services.