Install the HA component: Yum install PCs fence-agents-all create cluster pcs cluster setup--start--name my_cluster z1.example.com z2.example. COM Start Cluster service PCs cluster enable--all view cluster status PCs cluster status Create Stonith device pcs stonith create MYAPC FENCE_APC_SNMP params Ipaddr= "zapc.example.com" pcmk_host_map= "Z1.example.com:1;z2.example.com:2" pcmk_host_check= "Static-list" Pcmk_ Host_list= "z1.example.com,z2.example.com" login= "APC" passwd= "APC" PCs stonith show MYAPC creating Resources PCs resource Create My_lv M LVM volgrpname=my_vg exclusive=true--group apachegroup pcs resource Show PCs resource enable PCs resource create My_fs Filesystem device= "/dev/my_vg/my_lv" directory= "/var/www" fstype= "Ext4"--group apachegroup PCs resource Create Virtualip IPaddr2 ip=198.51.100.3 cidr_netmask=24--group apachegroup pcs resource create Website Apache configfile= "/etc /httpd/conf/httpd.conf "statusurl=" Http://127.0.0.1/server-status "--group apachegroup
PCS resource Create Virtualip ocf:heartbeat:IPaddr2 ip=192.16 8.0.120 cidr_netmask=24 opmonitorinterval= 30s
To view cluster status:
PCS status
Switching nodes: PCs cluster standby z1.example.compcs cluster Unstandby z1.example.com
View Help for PCs resource-h
Export and backup configuration Files PCs cluster CIB testfilepcs Config backuppcs config restorepcs cluster setup--name new_cluster NodeA NodeB--tok En 10000--join 100pcs cluster stoppcs cluster enablepcs cluster disablepcs cluster node add nodepcs cluster node remove n ODEPCS cluster standby nodepcs cluster unstandby nodepcs stonith listpcs stonith describepcs stonith show--fullpcs stonit H Create myapc-west-13 fence_apc pcmk_host_list= "west-13" ipaddr= "WEST-APC" login= "APC" passwd= "APC" port= "15"
Fence corresponding node: PCs stonith fence nodepcs Resource Delete virtualippcs resource describe Lvmpcs resource show--fullpcs Resource Enable resource_id
PCS resource Disable resource_id
Set resource succession relationship PCs constraint virtualip then Dummy_resource kind=optional
Enter Maintenance Mode: PCs resource unmanage Resource1
Release Maintenance Mode
PCS Resource Manage Resource1