Setting up a GlusterFS Client
In our previous tutorial, we deployed a GlusterFS cluster. This tutorial will extend that by showing you how to mount your GlusterFS volume on a server for storing files.
This tutorial was created using a Debian 8 server, but the steps should also work on Ubuntu without any changes.
Steps
Install the client packages:
sudo apt install glusterfs-client
Now create a directory for mounting the GlusterFS volume.
MOUNT_PATH="$HOME/gluster-mount" mkdir -p $MOUNT_PATH
Now mount the volume on the mount point we just created.
GLUSTER_HOST="gluster1.programster.org" VOLUME_NAME="volume1" MOUNT_PATH="$HOME/gluster-mount" sudo mount -t glusterfs \ $GLUSTER_HOST:$VOLUME_NAME $MOUNT_PATH # Give ourselves permission to create files in there. sudo chown $USER:$USER $MOUNT_PATH
You have now mounted the GlusterFS volume locally. If you use a tool like pydf
you will see something like below:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 1375M 16G 7.2 [##...................] /
gluster1.programster.org:volume1 19G 1375M 16G 7.2 [##...................] /home/stuart/gluster-mount
If you are not using the same servers as in the cluster as the client, then writing files to this area will not cost you anything in local storage. Best of all, you can mount the same volume on different servers simultaneously, which can be useful for automatic failover etc.
References
First published: 16th August 2018