Uncover the infinite in IT

Table of Contents
< All Topics

Storage Cluster with DRBD and GlusterFS

Two storage servers will use DRBD to replicate data and GlusterFS for sharing directories between MongoDB and Web Servers.

Prerequisites

  • Two storage servers with static IPs.

Step-by-Step Guide

Step 1: Install DRBD and GlusterFS on Both Storage Servers

1. Install DRBD and GlusterFS:

sudo apt install drbd-utils glusterfs-server -y
Step 2: Configure DRBD

1. Create a DRBD Resource File:

sudo nano /etc/drbd.d/data.res

DRBD Resource File:

resource data {
    protocol C;
    on STORAGE1 {
        device /dev/drbd0;
        disk /dev/sdb1;
        address <IP_STORAGE1>:7789;
        meta-disk internal;
    }
    on STORAGE2 {
        device /dev/drbd0;
        disk /dev/sdb1;
        address <IP_STORAGE2>:7789;
        meta-disk internal;
    }
}

2. Initialize DRBD:

sudo drbdadm create-md data
sudo drbdadm up data
Step 3: Configure GlusterFS on DRBD-Backed Storage

1. Create a Shared Directory on both nodes:

sudo mkdir -p /data/glusterfs

2. Create a GlusterFS Volume on STORAGE1:

sudo gluster volume create data replica 2 <IP_STORAGE1>:/data/glusterfs <IP_STORAGE2>:/data/glusterfs force
sudo gluster volume start data