I have an existing in-production LAMP server running Centos 5.1. It uses physical partitions on top of hardware RAID1, having / /home /var and /boot on separate partitions.
We have a near-identical system I am thinking of bringing in as a DRBD/Heartbeat companion. One solution may be to use csync2 [http://oss.linbit.com/csync2/] on /etc and /usr/local (the only areas that will differ from the stock CentOS). Then setup DRBD for /home and /var.
From reading the docs it seems we have to use "external meta data" on the existing partitions. Other than that, anyone have any caveats or better ideas for this setup?
Also - each has 2 NICs. Can Heartbeat do its pinging over the WAN (eth0) with eth1 dedicated to DRBD only? Is that how it is supposed to be, or should we use the serial ports?
Sam
sbeam wrote:
I have an existing in-production LAMP server running Centos 5.1. It uses physical partitions on top of hardware RAID1, having / /home /var and /boot on separate partitions.
We have a near-identical system I am thinking of bringing in as a DRBD/Heartbeat companion. One solution may be to use csync2 [http://oss.linbit.com/csync2/] on /etc and /usr/local (the only areas that will differ from the stock CentOS). Then setup DRBD for /home and /var.
From reading the docs it seems we have to use "external meta data" on the
existing partitions. Other than that, anyone have any caveats or better ideas for this setup?
Also - each has 2 NICs. Can Heartbeat do its pinging over the WAN (eth0) with eth1 dedicated to DRBD only? Is that how it is supposed to be, or should we use the serial ports?
You can decide on which nic heartbeat will do its broadcast ... serial port is optional and in certain cases it's even impossible to use serial port when machines are not located in the same computer room/building ... Don't forget that if you use ext3 on your /home and /var partitions you'll only be able to use it on one node at a time .. if you need both nodes to read/write to the drbd devices, you'll need to use a clusterfs (like gfs, gfs2) on top
sbeam wrote:
I have an existing in-production LAMP server running Centos 5.1. It uses physical partitions on top of hardware RAID1, having / /home /var and /boot on separate partitions.
We have a near-identical system I am thinking of bringing in as a DRBD/Heartbeat companion. One solution may be to use csync2 [http://oss.linbit.com/csync2/] on /etc and /usr/local (the only areas that will differ from the stock CentOS). Then setup DRBD for /home and /var.
From reading the docs it seems we have to use "external meta data" on the existing partitions. Other than that, anyone have any caveats or better ideas for this setup?
Also - each has 2 NICs. Can Heartbeat do its pinging over the WAN (eth0) with eth1 dedicated to DRBD only? Is that how it is supposed to be, or should we use the serial ports?
One KEY thing to understand about DRBD is that for the normal mode you CAN NOT mount the shared partitions on BOTH machines at the same time. (DRBD does have an active/active mode, but that is not it's major purpose ... DRBD is raid1 for partitions, so just like you can not write / mount BOTH mirrors of a raid1 drive at the same time, you can't do that on DRBD either.)
If you really are trying to get a failover machine where you do not need to have both partitions mounted and active at the same time, then DRBD is probably what you are looking for.
On Sat, May 31, 2008 at 7:40 AM, sbeam sbeam@onsetcorps.net wrote:
We have a near-identical system I am thinking of bringing in as a DRBD/Heartbeat companion. One solution may be to use csync2 [http://oss.linbit.com/csync2/] on /etc and /usr/local (the only areas that will differ from the stock CentOS). Then setup DRBD for /home and /var.
Probably not a good idea to put the whole "/var" in DRBD, since then the second machine will have it unmounted when it's in stand-by, and there are somethings like "/var/run", "/var/tmp" and "/var/spool" that might be needed even if the machine is in stand-by. I don't think you might actually be able to start heartbeat without a "/var/run" to store its pid file.
You would be better off by using a DRBD partition for "/var/lib/mysql" and leaving the rest of "/var" out of DRBD.
HTH, Filipe
Thanks guys for the info. I understand that the secondary machine needs a /var too while in standby, and since it can't also mount it as part of the DRBD array, then it has to be a vanilla partition on both machines. Thanks for clearing that up.
On Saturday 31 May 2008 09:28, Filipe Brandenburger wrote:
You would be better off by using a DRBD partition for "/var/lib/mysql" and leaving the rest of "/var" out of DRBD.
But DRBD only replicates entire physical devices right? So I would have to re-partition... if so I can't do that.
But we could move mySQL files to /home or something as well. Not pretty but it should work.
sbeam wrote:
Thanks guys for the info. I understand that the secondary machine needs a /var too while in standby, and since it can't also mount it as part of the DRBD array, then it has to be a vanilla partition on both machines. Thanks for clearing that up.
On Saturday 31 May 2008 09:28, Filipe Brandenburger wrote:
You would be better off by using a DRBD partition for "/var/lib/mysql" and leaving the rest of "/var" out of DRBD.
But DRBD only replicates entire physical devices right? So I would have to re-partition... if so I can't do that.
DRBD replicates partitions (does not have to be a separate physical device) ... the normal method is to create a new partition ... copy all the stuff to that partition that you want to fail over and sym link it back to its normal locations.
There is even a program called drbdlinks to automatically change the symlinks from normal when the drbd partition is in secondary mode (so you can easily do updates on your normal locations ... but the symlinks shift to the drbd partition when if becomes primary):
http://www.tummy.com/Community/software/drbdlinks/
But we could move mySQL files to /home or something as well. Not pretty but it should work.
On Sat, May 31, 2008 at 7:40 AM, sbeam sbeam@onsetcorps.net wrote:
I have an existing in-production LAMP server running Centos 5.1...
We have a near-identical system I am thinking of bringing in as a DRBD/Heartbeat companion...
Why don't you consider using MySQL master-slave replication? It seems to me that in your case that would be more simple, more flexible, more reliable, would require less bandwidth and would give you more performance than you can get with DRBD. Although DRBD is the latest buzzword and everybody wants to find an use for it, I think it's not the best tool for this job.
DRBD is dumb in the sense that it replicates blocks. If the application that does the replication knows the data, it knows what to send to the other side (record insertions and updates) and what not to (index data, since that will be recreated), and it also doesn't have to send a whole block of data each time you change a few bytes.
If you want automatic failover, you can still use Heartbeat to transform a slave node into master when the master goes down.
You will certainly find several recipes on how to do it on the web.
Just my humble opinion, but I hope this helps.
Filipe