GlusterFS is a scale out NAS file system. GlusterFS can be installed in production on hardware machines. The following article explains how to get started with GlusterFS. In order to get familiar with GlusterFS, we can install it on VMs or instances running on private cloud or a public cloud. The setup I installed GlusterFS on, is a 2 node setup.
Let us assume the IP of the machines are 10.0.0.1 and 10.0.0.2.
We need to make sure if internet connection before starting the installation. There are some steps that we need to perform on the both the nodes. Let us start off the installation with those steps.
Let us add the GlusterFS 3.5 repository to Ubuntu.
add-apt-repository ppa:gluster/glusterfs-3.5
Now that we have added the repository, we need to update the package list in Ubuntu.
apt-get update
After updating the package list, let us upgrade the packages.
apt-get upgrade
After the package upgrade reboot the instance if a new kernel is installed.
reboot
Now the machine will come up with the new kernel. Let us add a new hard disk to each of the nodes by adding a new volume to each of the instance.
After the volume is attached to the instance, it will show up as “/dev/vdb” in Ubuntu. Let us partition the hard disk to create a single partition on the whole disk.
fdisk /dev/vdb
Let us use XFS as the underlying filesystem. Let us now install XFS.
apt-get install xfsprogs
After the installation is over, let us format the partition that was created earlier to create XFS partition on it.
mkfs.xfs -i size=512 /dev/vdb1
Let us now create a directory in srv named ‘vdb1’.
mkdir -p /srv/vdb1
After the directory is created, let us mount the partition that was formatted now to that directory.
mount /dev/vdb1 /srv/vdb1
After the partition is mounted, we need to create a file named ‘brick’ in the folder ‘/srv/vdb1’
mkdir -p /srv/vdb1/brick
To mount the partition while booting, we need to add the following entry to /etc/fstab.
/dev/vdb1 /srv/vdb1 xfs defaults 0 0
Let us install GlusterFS now.
apt-get install glusterfs-*
Steps to be performed on node1:
Let us add the second node to the first one by running the following command on the first node.
gluster peer probe 10.0.0.2
Now let us create a volume named testvol from the 2 nodes
gluster volume create testvol replica 2 10.0.0.1:/srv/sdb1/brick 10.0.0.2:/srv/sdb1/brick
Let us start the volume we created now
gluster volume start testvol
The server configuration is done. Let us now use a client machine to mount the volume on. we need to install the client package on the client machine.
apt-get install glusterfs-client
Let us now create a directory that can be used to mount the GlusterFS volume
mkdir /mnt/gluster
Let us now mount the volume to test the setup
mount -t glusterfs 10.0.0.1:/testvol /mnt/gluster