[DRBD-user] DRBD with more than one secondary node

Brian Candler B.Candler at pobox.com
Sat Jul 5 11:31:20 CEST 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 Fri, Jul 04, 2008 at 01:31:00PM +0200, Hector Blanco wrote:
> I have currently two Xen virtual machines running into a physical
> machine. Each of the virtual machines is running a MySql instance,
> each of which write the data in a drbd partition (thus the Mysql data
> are the same). Over this, I have a Virtual IP controlled by HeartBeat.
> Now, if a machine or a mysqld process fails, all the MySql petitions
> are redirected to the other machine. As you may have foreseen, the
> Drbd resource is controlled by Heartbeat as well. I think this is a
> very typical configuration (I did more or less what is explained here:
> http://marksitblog.blogspot.com/2007/07/mysql-5-high-availability-with-drbd-8.html).
> You should be able to see (if imageshack still keeeps it) a simple
> diagram of what I currently have in the following address:
> http://img388.imageshack.us/img388/6832/pict01tv3.png As I said Both
> machines are Xen Virtual machines but it did't matter much... for the
> moment.

Given that these are two virtual machines on the same physical server, then
there doesn't seem to be much benefit in using drbd to replicate data
between them.

That is, the two virtual machines could both access
/dev/Volgroup-00/msqyl-data directly (as long as you were careful that only
one had it mounted at the same time). If you want local resilence then you
can use regular mirroring, e.g. using md.

So to get HA between two physical servers, then you could use drbd to
replicate between them, and use md within one server. I'm thinking of
something like this:


         VM1       VM2                            VM3       VM4
        xvda1     xvda1                          xvda1     xvda1
          |         |                              |         |
          +----+----+                              +----+----+
               |                                        |
           /dev/drbd0  . . . . . . . . . . . . . .  /dev/drbd0
               |                                        |
    /dev/Volgroup-00/msqyl-data                       ditto
               |
           /dev/md0
               |
          +----+----+
          |         |
     /dev/hda1  /dev/hdb1

This is all untested, and I don't know how you'd configure heartbeat with
two levels of failover (i.e. between VM1 and VM2 normally, but failing over
to VM3/VM4 in a "bigger" disaster). If it were me, I think I'd want to make
the "big" failover decision manually.

You may find that with this setup, you don't need VM2 and VM4 at all; that
is, just failover between VM1 and VM3.

Also, in theory it would be possible to live-migrate your VM between
platform one and platform two. In practice I've found this crashes after
more than one migration, and I think I came across a note somewhere saying
this was a known bug, but I couldn't find it again just now. It's OK if you
live-migrate machine 1 to machine 2, then reboot machine 1 before
live-migrating back from machine 2 to machine 1.

Of course, remember that drbd is not the only replication solution. You
could consider using mysql's own replication capability to replicate at the
application layer. This *does* support multiple replicas from the same
master.

Regards,

Brian.



More information about the drbd-user mailing list