[DRBD-user] Heartbeat, DRBD, MySQL and automatic resume from a failover

drbd at bobich.net drbd at bobich.net
Mon Feb 11 15:54:59 CET 2008

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On Mon, 11 Feb 2008, Thorolf Godawa wrote:

> - If starting only ONE of the servers, DRBD does not come up
> automaticly. I set "wfc-timeout 300" that the server at least starts
> without any user input, but heartbeat does not bring up DRBD in
> "Primary/unknown" status.
> But it is important that even if there is only one server starting and
> thus no redundancy, that heartbeat can bring up all ressources anyway!

I raised the exact same issue recently. The default behaviour is that 
nothing comes up as Primary/Unknown. It always comes up as 
Secondary/Unknown. What worked for me is to add:
drbdadm primary all
to the startup.

> - After a failover to the backup server there should NOT be an
> autofailback to the primary one. But the DRBD disk should reconnect
> automaticly as secondary disk to the primary one located on the backup
> server if the primary server was restarted. But this does not work, the
> (restarted) primary still shows "Secondary/Unknown" while the backup is
> in "Primary/Unknown" state, until I solve the problem manually with drbdadm.

Not sure, I haven't seen this problem (yet) because I haven't built my 2nd 
node. I suspect that doctoring the startup further will be required. 
Please, do post when you solve it.

Note, however, that I am operating in a Primary/Primary mode with GFS. 
This may be different in your setup. (e.g. with GFS I can safely do 
Primary/Primary).

Also, depending on the nature of your data access, you could solve this 
without shared storage. Set up MySQL in Master-Master replication mode 
rather than Master-Slave mode.

This article should give you the idea of how it works:
http://jayant7k.blogspot.com/2006/06/multi-master-replication-in-mysql.html

If you load balance them there are some potentially nasty race conditions 
(SQL is not commutative, so INSERT+UPDATE != UPDATE+INSERT). But if all 
you want is fail-over, and you are using heartbeat to migrate the MySQL IP 
address to the working node, you avoid that issue (and forfeit load 
balancing).

Finally, if you decide to try a Primary/Primary solution, IIRC you can set 
MySQL to use external locking. You can then have your MySQL databases on a 
GFS file system, with Primary/Primary DRBD and with both nodes operating 
on it simultaneously. This avoids the race condition of the MySQL 
master-master replication at the expense of some performance due to the 
extra locking overhead on writes.

These alternative approaches may or may not be more suitable for what you 
are trying to do, and performance will vary across them, depending on what 
your application does.

Gordan



More information about the drbd-user mailing list