Setup HA Cluster Services on CentOS 7
Install HA Cluster components
Install pacemaker and the cluster control software on both nodes that will be part of the cluster(corosync is pulled in as a dependency)
yum install pacemaker pcs
Enable and start the cluster management service
systemctl enable pcsd.service
systemctl start pcsd.service
Enable corosync and pacemaker to start on boot on all nodes
systemctl enable corosync.service
systemctl enable pacemaker.service
Set the hacluster user’s password
set hacluster password
Pa$$w0rd
Configure firewalld rules for HA Cluster
Now that the config file is edited, let’s make some firewall rule changes. If for some reason you aren’t using a firewall then you can skip this.
Configure a default zone with firewalld (The default zone is assumed to already be set as “Internal”)
Add services (or ports) to allowed rules
firewall-cmd --permanent --zone=internal --add-service=high-availability
You can just define ports if you like
firewall-cmd --zone=internal --add-port=2224/tcp
firewall-cmd --zone=internal --add-port=3121/tcp
firewall-cmd --zone=internal --add-port=5404/udp
firewall-cmd --zone=internal --add-port=5405/udp
firewall-cmd --zone=internal --add-port=21064/udp
Finalize cluster configuration
Setup cluster auth (use hacluster and the pass that was set)
pcs cluster auth
Setup cluster (select the appropriate names and nodes)
pcs cluster setup --name lognode-ha lognode01 lognode02
Start the cluster from a single node
pcs cluster start --all
or run this on all nodes
systemctl start corosync.service
systemctl start pacemaker.service
Check cluster status (next three commands)
pcs status cluster
pcs status nodes
pcs status corosync
Disable “Shoot The Other Node In the Head” (STONITH) functionality
pcs property set stonith-enabled=false
Disable quorum policy because we only have two nodes
pcs property set no-quorum-policy=ignore
Display list of cluster properties
pcs property
Create a resource for the shared IP
pcs resource create SharedIP ocf:heartbeat:IPaddr2 ip=xxx.xxx.xxx.xxx cidr_netmask=32 op monitor interval=10s
Verify cluster functionality
pcs status resources