Setting up the Servers

Here's what you need to install to make all this work. You'll need TWO servers to do this, since this is a two-node cluster. Both machines should be set up identically (except for IP addresses, of course). We start out with a minimal Debian Lenny install on both machines. When you set the machines up, you'll need to think about partitioning the drive(s). DRBD needs its own "backing device" for each "partition" that you want to keep in sync between the two machines. The "backing device" can be an entire drive, it could be a partition on a drive, it could be a RAID array, a logical volume, whatever. You'll need identically sized "backing-devices" on both machines. DRBD also needs a partition to store meta-data. You can store it on the same partition as the data itself, UNLESS that partition is a RAID5 array. You should not store meta-data on a RAID5 array for performance reasons. In that case you'll need an additional (small) partition for the meta-data. (See here for estimating the size needed for the meta-data.) In our systems, we use two, 1 TB drives with the following 4 partitions on each drive:

  • 100 MB for a RAID1 array (/dev/md0) that will be mounted as "/boot"
  • 5 GB for a RAID1 array (/dev/md1) which will be mounted as "/"
  • 1 GB for swap
  • All remaining space for a RAID1 array (/dev/md2) that will be used for DRBD

Also, the two DRBD machines need a direct cross-over cable between them. Do not do DRBD replication over an internal network no matter how fast it is. Use a cross-over cable. In our case, that means our machines all need three interfaces - eth0 - internet, eth1 - internal, eth2 - DRBD. Now we need to install the necessary software. Install everything on both servers. First you need a vserver kernel in order to run vserver virtual machines. You'll want the "linux-image-vserver" package for your architecture. Ours is AMD64. apt-get install linux-image-vserver-amd64 That will give you the latest vserver kernel. Then you'll also need the 'util-vserver' package to run vservers if it doesn't get pulled into automatically as a dependency for the vserver kernel. apt-get install util-vserver Now you need to reboot the machines and make sure the vserver kernel is booted. Then install the DRBD software. If your DRBD device will be larger than 4 TB, then you'll need to get the DRBD source and compile the modules yourself because what's in Debian Lenny can't handle more than 4 TB. In this case we'll assume you don't need that and we'll stick with installing directly with 'apt-get'. (Get the proper module for your architecture, of course.) apt-get install drbd8-modules-2.6-amd64 apt-get install drbd8-utils Finally let's install heartbeat to handle the cluster notification and administration. apt-get install heartbeat