Developers guide

Chapter 8
Copyright © 2008-2013 Inverse inc.
Operating System Best Practices 69
Make sure you see something like this in /proc/drbd:
...
0: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:30702640
Synchronize the servers by forcing one to become the primary. So on pf1 do:
# drbdadm -- --overwrite-data-of-peer primary mysql
After issuing this command, the initial full synchronization will start. You will be able to monitor its
progress via /proc/drbd. It may take some time depending on the size of the device. Wait until it
completes.
When the sync is complete, create the filesystem on the primary node only:
# mkfs.ext3 /dev/drbd0
Make sure DRBD is started at boot time:
# chkconfig --level 2345 drbd on
Restart both servers.
When done, look in /proc/drbd and make sure you see:
...
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r---
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
MySQL Configuration
Note
By default MySQL puts its data in /var/lib/mysql. In order to replicate data between
the two servers, we mount the DRBD partition under /var/lib/mysql.
When first starting MySQL, the partition must be mounted.
In order to do so:
On the master server (the server you are working on), tell DRBD to become the primary node with:
# drbdadm primary mysql
mysql being the name of the DRBD partition.
In /proc/drbd you should see something like: