dracoblue.net

Using GlusterFS for high available storage on Ubuntu

With this setup we will make two servers using a shared storage as high availabile mount. Both of them host the data, if one of them is down, the other one will stay the source of truth for so long. Disadvantage of this approach is, that the files exist 4 times: at server1 and server2 each with /mnt/barrel (the mounted directory) + /var/glusterfs/barrel (the glusterfs working directory).

Install glusterfs server and client

On both machines run as root:

$ sudo apt-get install glusterfs-server glusterfs-client

This makes the glusterfs server available and will allows us to connect to the server later on.

Create the volume

On both machines run:

$ sudo mkdir -p /var/glusterfs/barrel

Finally create the volume on the first server:

$ sudo gluster volume create barrel replica 2 transport tcp server1.example.org:/var/glusterfs/barrel server2.example.org:/var/glusterfs/barrel```

Start the volume

On one of the servers you have to start the volume:

$ sudo gluster volume start barrel

Mount the volume

Since both servers want to access the mount, you have to run this code on both servers:

On server 1 mount the local storage to the local server:

$ sudo mount -t glusterfs server1.example.org:/barrel /mnt/barrel

And now the same for server 2:

$ sudo mount -t glusterfs server2.example.org:/barrel /mnt/barrel

Testing the mount

If you do:

$ sudo touch /mnt/barrel/hans.txt

on one of the servers, it should instantly appear on the other server.

If you look into the storage folders at /var/glusterfs/barrel they should containt 100% of the items, too.

That's it! What do you think of this setup? Anything I am missing here?

In glusterfs, open source, ubuntu by
@ 29 Sep 2014, Comments at Reddit & Hackernews

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About