Article on Active/Passive MYSQLSQL Cluster, setup using Pacemaker with
Corosync and DRBD
We use two nodes, one active (that answers requests from apps) and the
other on passive mode. If the active server is down, the passive one will
automatically take its position (being the active node).
One issue that must be remembered is that we use DRBD to replicate the
data between the nodes, then we need to have a disk or partition exclusive
to DRBD, which should be mounted to mysql directory /data01 , from our
cluster setup 'Rancho' servers db701a is in active mode &701b is in
/dev/drbd0 on /data01 type ext4 (rw)
/dev/sda1 on /boot type ext4 (rw)
If there is an failover in the active mode(i.e db701a) ,will automatically
switches to db701b .then passive server will be active , sync will be from
b to a.
Important note :We need to leave one partition exclusive to DRBD, on
active node of the server .
Overview of MySQL with Clustering Application:
DRDB (Distributed Replication Block Device) is one of the leading
solution for Mysql when combined with Pacemaker , Corosync. DRBD
synchronizes data at the block device (typically a spinning or solid state
disk) – transparent to the application, database and even the file system.
Any changes made on the active host are synchronously replicated to the
standby host by DRBD, they are accessible for reads and writes on exactly
the same on both the nodes , the two hosts (Active/Standby) are required in
order to provide physical redundancy; for suppose if we are using virtual
environments those 2 hosts should be on different physical machines, one
important feature no shared storage is required at any point of time , the
services will be active on one host and in standby mode on the other.
Pacemaker and Corosync combine to provide the clustering layer that sits
between the services & Hosts
Pacemaker is responsible for starting and stopping services, ensuring that
they are running on exactly one host at time.
Corosync provides the messaging infrastructure between the nodes that
enables Pacemaker to do its job,
it also handles the nodes , within the cluster and informs Pacemaker for
any changes required in case of failovers.
· Building of HighAvailability clusters from commodity hardware,
without the requirement for shared-storage.
· Automatic failover and recovery for service continuity.
· An end-to-end, integrated stack .
· synchronous replication, to ensure failover between nodes
without the risk of losing committed transactions
Three important things to be noted
· drdb should be mounted to active node
· Making sure mysql data directory , & my.cnf files are pointed
to specified location.
root@db701a:~# ls -l /etc/mysql/my.cnf
lrwxrwxrwx 1 root root 20 Mar 6 10:54 /etc/mysql/my.cnf ->
root@db701a:~# ls -l /var/lib/mysql
lrwxrwxrwx 1 mysql root 13 Mar 3 16:47 /var/lib/mysql -> /data01/mysql
· Virtual IP should be pointed to active node first .
Please share your some more points .