DRBD with OCFS2

= Introduction = This is a guide for DRBR with OCFS2.

The tough came with found that samba Active Directory (AD) Domain Controller (DC) sysvol is not being replicated between DC as current Samba4 known limitation.

Q: Why DRBD only is not enough...

There might be case where there are multiple write access to the block device by multiple server, thus without cluster files system we will have trouble on files locking and etc since the DRBD volume are being mount by 2 or more server, so OCFS2 is selected for it performance and also popularity.

You can use always other Cluster files system.

This guide only 2 node, dual primary configuration. If you required more node, please check on drbd for more information.

= Prerequisite = Below are the kernel need.

= Packages = Please emerge the following package

Check more on DRBD

DRBD 8.4 guide do suggest the use of heartbeat and also pacemaker. But I think that was just too complicated...

You are welcome to try and add on an option with heartbeat and peacemaker.

= DRBD Configuration = We will now configure DRBD.

Please check the DRBD User’s Guide Ver 8.4 on their website it is well written with example.

This is a Global DRBD configuration. It will need to change according to your DRBD need. Please check the on the manual for more info.

Please create the files below.

If you have multiple resource setup, you can do it one resource per files to avoid confusion.

Below files is a 2 Node Resource example. Note on the Comment Part, they will need to be uncomment at a much later part when we enable dual primary.

In plain English, we will use on serverNode01 (IP 192.168.11.23) and  on serverNode02 (IP 192.168.11.27) to create a drbd node  respectively on both server. Both drbd node will store the metadata on internally.

= OCFS2 Configuration = We will now continue with OCFS2 Setup.

Unfortunately ocfs2 configuration don't include the cluster files example and thus you will need to copy the files below as an example.

Please change what even which suit your needm

Now it is time to change files. There are a lot of configurable parameters there but we will only make one change. and change it to ocfs2 cluster name.

It is also time we add the required mount to. Please add the following.

= DRBD Initialization and Setup = After we have all this.

It is time to initial DRBD

Let us up this DRBD devices.

When both node is up. We can check on the BRDB status.

When Both node is up, we will see something...

The Secondary/Unknown become Secondary/Secondary.

We now have the DRBD device.

Let start to synchronization both node BRDB by making it primary

Let us check the synchronization status

Please wait until it is done.

Let make 2nd Node primary

Let start the DRBD services

Yes, Our DRBD cluster are done. Now let continue to the OCFS2 Setup

= OCFS2 Setup = The 1st things we need to do is to mount the required kernel config and dlm that needed by OCFS2. Since that we already modified the. You can simple follow the command below.

We should now start the OCFS2 Cluster

Now let us make the DRBD cluster run OCFS2

Enable Dual-Primary Mode
To enable Dual-Primary mode is easy, just uncomment the resources files we have made on top.

Than time to make change on both node, in sequence primary then only secondary.

Check if drbd are now dual primary

We can now mount it the OCFS2 cluster on both node.

= Adding both DRBD and OCFS2 on system boot = Let us start both DRBD and OCFS2 when system boot up.

= Manual Split Brain Recovery = Summary from Under certain condition, Split Brain will happen and cannot be recover automatically by system. And we have to manually recovery the DRBD disk.

Split Brain Victim, Choose a node which that the changes will be discarded
We will disconnect this node, make it secondary and connect it back to the drbd array and we will discard all the different. So that it will sync with the latest version from other node.

Split Brain Survivor, Choose The node which we have the latest version of files
We just connect this back to the drbd array so secondary will sync from here.

Result
Sync should happen and we should have our array back. What if that don't happen.

Troubleshooting and error recovery

= See also =
 * DRBD

= External Reference =