DRBD with Cluster File System on Debian Jessie

Hi,

I’m Sina Moghaddas, and this my first post as a co-author to my brother ?

In this post, I am going to show you how to setup DRBD with OCFS2.

DRBD® refers to block devices designed as a building block to form highly available (HA) clusters. This is done by mirroring a whole block device via an assigned network. DRBD can be understood as a network based raid-1.

OCFS2 is a general-purpose, shared-disk, clustered filesystem for Linux, which is capable of providing both high performance and high availability.

ok, here we go ?

I setup the scenario on two Debian 8.2 (3.16.0) machines with the following details:

Host 1
  • Hostname: d-2-t-1
  • IP: 192.168.100.110
Host 2
  • Hostname: d-2-t-1
  • IP: 192.168.100.120
Installation

Let’s verify hosts on both nodes:

I use DRBD with 2 different methods.

Method 1: Primary/Secondary

Now, we have to create DRBD and start it:

# on both nodes
drbdadm create-md drbdsimo
 
modprobe drbd
drbdadm up drbdsimo

And specify the Primary node:

# on Node 1 -> make it Primary
drbdadm -- --overwrite-data-of-peer primary drbdsimo

Now let’s check the status:

I have the block, so let’s create the filesystem and mount it somewhere:

# on Node 1
mkfs.xfs /dev/drbd1
mount /dev/drbd1 /mnt

Keep in mind that you can’t mount it on two nodes.

Now I wanna change the Primary node:

Method 2: Dual-primary DRBD with OCFS2

This should be implemented only with a clustered filesystem. If you do this with a non-clustered filesystem like ext2/ext3/ext4 or reiserfs, you will have a huge data corruption. Seriously!

In this method, you can mount the block on both nodes with the edit option.

Firstly, I make a script for my simulated file:

Creating DRBD, staring and then verifying it:

With the last command, I made the second node to be Primary.

Now I have a Primary/Primary DRBD!

Right now, I want to setup my clustered filesystem.

Cluster File System

After some researches, I found out that OCFS2 has a really amazing performance.

So, let’s set it up and make the configuration ?

Then we have to start and enable it on both nodes:

Making the filesystem:

And making a mount-point and adding it to startup, and then mount it:

Done ?

I hope this has been informative and you have enjoyed the setup!

Share this!

Author: Mo Moghaddas

Building zeeg.me to give users more time back and make scheduling a pleasant experience.

3 thoughts on “DRBD with Cluster File System on Debian Jessie”

  1. Thanks you for it.
    If you add a new disk on each node for drbd, don’t forget to use fdisk on it 😀
    I still have a problem when rebooting : even if I wrote new entries in my fstabs, I need to mount drbd manually. Luckily, I ‘m rarely rebooting my servers.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.