Setup GlusterFS
A step by step guide of how to set up GlusterFS on two servers (nodes)
Note
Configure Hosts file
We use hosts to use names instead of IP addresses.
Edit the /etc/hosts with something like this:
10.0.15.10 gfs01
10.0.15.11 gfs02Install GlusterFS
apt install glusterfs-serverStart the service and enable it.
service glusterd start
systemctl enable glusterd
service glusterd statusMake a partition
BUT create a xfs file system. And follow this setup for this file system.
mkfs.xfs -i size=512 /dev/sda5
[...]
echo '/dev/sda5 /glusterfs xfs defaults 1 2' >> /etc/fstabConfigure the firewall
The Gluster processes on the nodes need to be able to communicate with each other. To simplify this setup, configure the firewall on each node to accept all traffic from the other node.
We will add only the interface as well, where the Glusters communicate, the interface is wg0 for example.
iptables -I INPUT -i wg0 -p all -s <ip-address> -j ACCEPTConnect the peers
gluster peer probe gfs01Check status:
gluster peer statusSet up a GlusterFS volume
Create a directory gv0 on the partition created for GlusterFS.
mkdir /glusterfs/gv0Do this next two commands only on one node.
gluster volume create gv0 replica 2 gfs01:/glusterfs/gv0 gfs02:/glusterfs/gv0If you only using 2 nodes make sure of the split brain problem
Start the volume
gluster volume start gv0You can check if it's working on both nodes with the command:
gluster volume infoMounting the GlusterFS Volume
If you want to use the GlusterFS volume, mount the volume to any client.
mount -t glusterfs server1:/gv0 /mnt/dStorageList of sources
HowtoForge.com __- Muhammad Arul - https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-ubuntu-1804/
Last updated
Was this helpful?