What is GlusterFS?

GlusterFS(Which was developed by Gluster inc and acquired by Redhat in 2011) is a distributed network file system characterized by:

  • Scalability,
  • High availability

A a lot of applications needing shared storage are using it including:

  • CDN : content delivery networks,
  • Media streaming,
  • Cloud computing,
  • Web cluster solutions

High availability is ensured by the fact that storage data is redundant if a node goes down  another will cover it without service interruption.

How does it work?

To get GlusterFS up and running, these are the strictly necessary steps:

For those wha are nor familiar with GlusterFS, I recommend that you start by choosing your preferred setup method such as AWS, virtual machines or bare metal (you can do this after step 4 when you will add an entry to fstab). Otherwise, you can get started with the steps below:

You will need to have at least:

  • Two X86 machines with a 64 bit OS and a working network connection,
  • At least 1GB of RAM is the bare minimum recommended for testing,
  • At least 8GB in any system you plan on doing any real work on,
  • A single CPU is fine for testing, as long as it is 64 bit.
  • “Bricks” are the nodes for GlusterFS. Each node should have a dedicated disk. One of these nodes will be serving the Gluster volume to clients: this will be called “node01”, the other one will be called “node02”, and so on.

Step1: Partition, Format and mount the bricks

Assuming you have a brick at /dev/sdb

sudo fdisk /dev/sdb

Create a single partition on the brick that uses the whole capacity.

Format the partition

sudo mkfs.xfs -i size=512 /dev/sdb1

Note: XFS is a high-performance 64-bit journaling file system and that is the reason we taken this filesystem to format the disk.

Step2Mount the partition as a GlusterFS “brick”

sudo mkdir -p /srv/sdb1
sudo mount /dev/sdb1 /srv/sdb1
sudo mkdir -p /srv/sdb1/brick

Add an entry to /etc/fstab

echo "/dev/sdb1 /srv/sdb1 xfs defaults 0 0" | sudo tee -a /etc/fstab

Step3: Install GlusterFS packages on both nodes

sudo yum install glusterfs{,-server,-fuse,-geo-replication}

Note: This example assumes Fedora 18 or later, where gluster packages are included in the official repository

Step4: Run the gluster peer probe command
Note: From node01 to the other node(s)

sudo gluster peer probe node02

Note: You can use IP addresses instead of hostnames, but it’s not recommended.

Configure your GlusterFS volume

sudo gluster volume create VOLUME_NAME replica NUMBER_OF_NODES NODE1:PATH1 ... NODEX:PATHX

The volume name here is testvol and the replication is between 2 nodes:

sudo gluster volume create testvol replica 2 node01:/srv/sdb1/brick node02:/srv/sdb1/brick

Start your GlusterFS volume

sudo gluster volume start testvol

Mount your GlusterFS volume

sudo mkdir /mnt/gluster
sudo mount -t glusterfs node01:/testvol /mnt/gluster

Test using the volume

sudo cp -r /var/log /mnt/gluster
sudo mkdir /mnt/gluster/hello_world
df -h

Hope this blog helped you setting up GlusterFS file system. Please comment and share your thoughts on this.

The following two tabs change content below.
I am a hands-on, competent Linux system engineer with 5 years’ experience. I have a strong performance background in wide variety of professional Linux system support including monitoring, configuration, troubleshooting and maintenance. I have worked on numerous projects from concept to completion. A specialist in LAMP platforms, I take pride in administrating Linux systems and regularly refresh my skills to ensure I keep up with ongoing developments and new technologies.