I would like to create an HA Cluster using OpenVZ and DRBD. I found this tutorial http://www.olindata.com/blog/2013/12/building-ha-cluster-openvz-drbd-heartbeat-and-pacemaker and I got as far as Step 5. I am running CentOS 6.5 (32-bit) under WMware Workstation 10.0.3 build-1895310 which is installed on Windows 7.

Under Step 5, The next thing I should do is to configure the DRBD. I have it installed, but it's the first time I am using OpenVZ and I'm a bit unclear about how should I used DRBD with it. I have two scenarios in mind:

  1. I install multiple Linux templates specified under Step 3, and I add the DRBD config files on each one.
  2. I create another virtual machine using CentOS, I install OpenVZ on top of it and I add the DRBD config files in each "OpenVZ machine", not on the VEs.

I also found this https://openvz.org/HA_cluster_with_DRBD_and_Heartbeat and from Step "Installing OpenVZ" I understand the second scenario is the right one: Get the OpenVZ kernel and utilities and install them on both nodes.

But if the second scenarios is the right one, the DRBD is supposed to synchronize Linux templates installed on the primary node?


First it's really important to understand what DRBD is (as configured in both examples): you have a partition replicated between two nodes (servers); one is "primary" that you can read/write to, and the other is "secondary" which holds a real-time replica of the data which you cannot interact with.

The idea is that when one node fails/is brought offline, you fail over (using Heartbeat or another mechanism) the "primary" status to the second server where you can use the resources further, ideally switching back when the primary node recovers.

So yes, you are installing your templates on the DRBD'd partition of the primary node, and the secondary node is a "hot spare" which service can be failed over to should it be required. I'd recommend following the guide straight from openvz.org as it seems more complete and in-depth.

If you want multi-master (i.e. read/write on both hosts), you need a cluster-aware filesystem installed on top of DRBD, and the "allow-two-primaries" option set in the DRBD config. But that is beyond the scope of those guides or this post.

  • Should I create a separate partition for each template? – Tanatos Daniel May 29 '15 at 0:38
  • That depends where you want each template to run. If all of them will be on the first server unless it goes down, then one partition is fine. If you want to have some run on the other server, you have a number of options, one of which is multiple DRBD'd partitions. What exactly do you wish to accomplish overall with this cluster? – Joshua Boniface May 29 '15 at 2:16
  • I would like to have three templates running different applications on a the primary server. In the event one of them fails, I would like it replaced by the corresponding template from the secondary server. Sounds to me that I should go with the first option you stated. Is it necessary for the templates to be situated (all of them) on a separate partition than the ones the primary server has? – Tanatos Daniel Jun 6 '15 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.