Installing Pacemaker and Corosync

Notes

Pacemaker is the cluster resource manager (CRM), it recives informations from the communication layer (CCM) and it manages resources and executes events. Corosync is responsible for the cluster communication, called cluster communication manager (CCM), the alternative product of corosync is heartbeat.

Pacemaker and Corosync

In this documentation the primary pacemaker server is called lb1 (loadbalancer1) and the slave pacemaker server lb2 (loadbalancer2). The operation system on both server are debian wheezy, it should be working also on the newest debian release jessie.

Installation

Install pacemaker and corosync, don’t forget to run apt-get update befor you install new packages.

Configuration





Generate private key on lb1 to ensure authenticity and privacy of the messages in the cluster communication. The command below writes the private key in /etc/corosync/authkey. This private key must be copied to every node in the cluster, in our case lb1 (already generated) and lb2. If the key isn’t the same for every node, those nodes with nonmatching key will not able to join the cluster.

Copy the privat key to every node, in our case from lb1 to lb2.

The corosync configuration is stored in /etc/corosync/corosync.conf, the configuration must be the same on every node. We need only to modify the setting bindnetaddr on lb1 with the network interface that we should use, I use always a dedicated network interface. We can also add other network interfaces to guarantee the redundancy. Here an example for the dedicated network interface configuration:

lb1

lb2

Edit the corosync configuration and make the changes.

Here an example configuration for two network interface

Copy the corosync configuration from lb1 to lb2

Edit default corosync init.d configuration on lb1 and lb2 to allow the init.d start.

Start corosync on lb1 and lb2

Now we can use the cluster resource manager tool to manage cluster resources on lb1 or lb2.

Check the status and verify if both nodes are online

Type configure in the crm console to enter in the configuration section

Pacemaker default behavior is to stop all resources if the cluster doesn’t have quorum. A cluster is said to have quorum when more than half nodes are online, this will working fine in a three-nodes or more cluster, but not in a two-nodes cluster like in our case. Therefore a two-node cluster only has quorum when both nodes are running, this makes no sense, so we need to disable quorum.

Stonith is the pacemaker fencing implementation, we skip the stonith configuration for the moment, you can read this documentation for a fancing implementation with a Micro$oft Hyper-V host Configure Pacemaker fencing and stonith with Hyper-V Driver, for more information read Fencing and Stonith. Set stonith to false

Commit the changes

Show configuration

Leave the configuration section and quit the cluster resource manager

Check also the ring status

3 responses to Installing Pacemaker and Corosync

Leave a Reply