Now that we have two machines that are identical (With the exception of IP and host name.) The next step is to download, install and configure DRBD. To achieve this I used a few posts and combined them into the setup that I wanted to setup. Some of the posts include

First thing I did was to check the disk to ensure that they were the same and all connected to the machine correctly

DRBD

Next I installed DRBD and heartbeat

I am going to create a single share called disk1. With that in mind I created the configuration for this by creating the following file

Here is the configuration I added into that file.

A few items I would like to point out.

  • Protocol C – There are three possible protocols which all have different levels of risk. More here.
  • shared-secret – This needs to be the same on both ends.
  • rate 100M – This allows you to cap the speed of the connection between the hosts. More here.
  • Pay particular attention to the on vNas01 and on vNas02 they need to reflect the settings on the host (i.e. what drive is being used, what is the host IP, etc).

This file needs to be duplicated onto both hosts.

Then we change ownership and permissions on DRBD files to be able to be used correctly with Heartbeat.

Initialize the meta-data disk on both hosts

And then started DRBD on both hosts

Now its time to pick a master. I used vNas01 as the master and to start the initial sync I ran

This sync took a long time. (almost 24 hours). To watch its progress you can run

Once the initial sync is complete we can start to setup the file system on the drive. First things first we need to install JFSUtils as we are going to use JFS. This is done on both hosts.

Once the sync is complete and jfsutils is installed, go ahead and create the partition on the drive and then create a mount point for the drive. This only needs to be done on the primary host (vNas01)

Now, it is a good idea to test the file system to ensure it is working correctly. Write a test file to the drive from the primary.

A little bit of house keeping on the primary to clean up the file system

Switch to the secondary host (vNas02), where we will mount the resource and then remove the file to ensure sync works both ways.

Then we switch back to vNas01 to check the file is missing

 NFS

Install the NFS Server onto both hosts.

Removed the runlevel init scripts on both nodes

Move the NFS locks and configuration to the DRBD device. (This way the settings transfer to which ever host holds the resource)

Then we add the file system to be the NFS share. (My network is 192.168.0.0/24)

 Heartbeat

Last I configured heartbeat to transfer resources between machines if one goes offline. More information on the ha.cf file

Then we define the Authkeys for the cluster

And lastly we define the resources that should be failed over if required

Then we reboot both servers.

Testing

To test the setup, I added the NFS share to one of my ESXi boxes and started a file transfer into the Storage. Then I restarted the primary node and watched it fail over.

At any time you can see the status of the cluster by running

Which will show you the status of DRBD from the perspective of the host. (i.e. is in the primary etc)/

Next I will cover some notes and thoughts about the setup.