PCS Cluster Setup - saviovettoor/DevOps-wiki GitHub Wiki

Pacemaker : cluster resource manager. It manages all cluster services (resources) and uses the messaging and membership capabilities of the underlying cluster engine. Corosync cluster engine. Resources have a resource agent, which is an external program that abstracts the service.

In an active-passive cluster, all services run on a primary system. If the primary system fails, all services get moved to the backup system. An active-passive cluster makes it possible to do maintenance work without interruption.

Cluster Node Setup:

Make a host entry on each node for all nodes, the cluster will be using the hostname to communicate with each other:

alt text

1. Installing Cluster Packages on Nodes

]#yum -y install corosync pcs pacemaker

2. Set the new password for cluster user “hacluster” on both the nodes.

]#sudo passwd hacluster

3. Enable the pcsd daemon on both the nodes to start automatically across the reboot. pcsd is pacemaker configuration daemon. (Not a cluster service)

]#systemctl start pcsd
]#systemctl enable pcsd

4. Login to any of the cluster node and authenticate “hacluster” user

]# pcs cluster auth testserver1.savio.com testserver2.savio.com

5. Create a new cluster using pcs command.

]# pcs cluster setup --name cluster_web testserver1.savio.com testserver2.savio.com

alt text

6.Start the cluster using pcs command. “–all” will start the cluster on all the configured nodes.

]# sudo pcs cluster start --all

7. Check the cluster status

]# pcs status cluster

alt text 8. To check the status of the nodes in the cluster:

]#  pcs status nodes
  1. To check the configuration for errors, and there still are some:
]# crm_verify -L -V

alt text

10. The above message tells us that there still is an error regarding STONITH (Shoot The Other Node In The Head), which is a mechanism to ensure that you don’t end up with two nodes that both think they are active and claim to be the service and virtual IP owner, also called a split brain situation. Since we have a simple cluster, we’ll just disable the stonith option:

]# pcs property set stonith-enabled=false

11. While configuring the behavior of the cluster, we can also configure the quorum settings. The quorum describes the minimum number of nodes in the cluster that need to be active in order for the cluster to be available. This can be handy in a situation where a lot of nodes provide simultaneous computing power. When the number of available nodes is too low, it’s better to stop the cluster rather than deliver a non-working service. By default, the quorum is considered too low if the total number of nodes is smaller than twice the number of active nodes. For a 2 node cluster that means that both nodes need to be available in order for the cluster to be available. In our case, this would completely destroy the purpose of the cluster.

To ignore a low quorum:

]# pcs property set no-quorum-policy=ignore

Add a new virtual IP to the cluster:

]#  pcs resource create virtual_ip_218 ocf:heartbeat:IPaddr2 ip=10.0.0.218 cidr_netmask=32 op monitor interval=30s
]# pcs status resources

alt text

To see who is the current owner of the resource/virtual IP:

]#  pcs status|grep virtual_ip

alt text

Delete a Virtual IP or Resource

]# pcs resource delete virtual_ip_218

alt text

⚠️ **GitHub.com Fallback** ⚠️