I have been looking around for some easy and open-source ways to handle database synchronous replication.
DRDB on a Linux server seems to be one of the fastest and easiest methods to handle database synchronization for DR purposes and HA.
I want to set up the above fact between two ubuntu 12.04 Machines treating one machine as active and another as passive.
I need some handy guidance and useful steps to setup this fact.
Best Answer
I would suggest you to use active-passive cluster with drbd. Active-Active leads to more problems then it solves especially if you use MySQL as database because you can't run 2 MySQL Daemons on the same Database!
Creating drbd cluster is simple. You have to do the following steps on both servers.
Thats the concept.
Here a short overview of the commands to use:
Server1 and Server2: Create a partition for the complete Harddisk sdb
Install drbd
Create a config file at /etc/drbd.conf:
Create the drbd device on both servers
Check the state
There should be a line with "cs:Connected ro:Secondary/Secondary" The first "Secondary" is the server you are logged in and the 2nd "Secondary" is the other server.
Now make the first server to the master and override all data on the server2
You could watch this process in /proc/drbd
No you can mount your new drbd device on the master:
if you like to switch master and slave you can use the commands:
or
Based on the server where you are logged in. But remember only one server could be primary.
For Active-Active scenario you need a cluster file system like ocfs2.
Use this manual with caution because this could delete your data.
You will find more information at drbd.org: http://www.drbd.org/users-guide-8.4/
A complete alternative is to use the DRBD MC - the Management console created by LINBIT, its a java application running on a workstation and connects to the servers over ssh and make the configuration for you. http://www.drbd.org/mc/lcmc/