Pacemaker – Configure cluster

Today some simple commands to configure a cluster with two ip adresses and a service on two servers with ubuntu 14.04

Let start installing some packages

Than adjust some configuration. The first is to enable pacemaker to run without quorum (you need it if the servers are less than three)

Now edit corosync config

and modify this section:

Now change /etc/default/corosync and put the variable to “yes”.
It’s time to start corosync and pacemaker

With the last command, pacemaker inform us about its state. Here is the output

It’s time to instruct our beloved os to start pacemaker at startup

You must do all the previous operations on both servers
From now, we will use pacemaker shell. Start it only on one server, the replication is automatic 🙂
Enter the shell

The prompt show the name of the cib (think about it as a container of configurations) between bracket. We will now create a new cib, to avoid problem with the cib in production

Adjust some configurations

Add two ip to our cluster. LOG-IP_10.183 and LOG-IP_180.1 are logical names for our resources. Change them to your needs

Add ip addresses to a group so it is more easy manage them

Now create a resource for haproxy. “LOG-HAProxy” is the name of our resource. “lsb:haproxy” is the resource script and pacemaker use it to start, stop, chek status of a service. You can find other scripts with “crm ra classes” and then “crm ra list

Even if is a single service resource, we will add it to a group, for easy of management

Now instruct pacemaker to start ip addresses and service on the same machine and in which order

Review what we have done

Commit cib to production and exit

Take a look at our creature 🙂

Posted in Linux, Tutorial.