Skip to main content
1 of 2
RolandoMySQLDBA
  • 184.4k
  • 33
  • 323
  • 531

Unfortunately, it is not possible to do either one.

Once you create /dev/drbd0 on both DB Servers, you have to mount the DRBD Primary on a folder. That folder cannot have anything with active file handles. The protocol I use is:

drbdadm primary drbd0
mount /dev/drbd0 /var/lib/mysql
service mysql start

You want DRBD to house MySQL Data. Here is what you must do instead

service mysql stop
mv /var/lib/mysql /var/lib/mysql_old
mkdir /var/lib/mysql
chown mysql:mysql /var/lib/mysql
drbdadm primary drbd0
mount /dev/drbd0 /var/lib/mysql
cp -R /var/lib/mysql_old /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
service mysql start

As shown, stopping mysqld is mandatory.

RolandoMySQLDBA
  • 184.4k
  • 33
  • 323
  • 531