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) +
(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?