GlusterFS using Ubuntu16.04
This basic setup uses gluster00 and gluster01 as its nodes and gluster02 as its client.
Requirement to this guide : Having an empty / unused partition available for configuration on all bricks. Size does not really matter, but it needs to be the same on all nodes.
Configuring your nodes
Configuring your /etc/hosts file :
## on gluster00 :
127.0.0.1 localhost localhost.localdomain glusterfs00
10.1.1.3 gluster01
10.1.1.4 gluster02
## on gluster01
127.0.0.1 localhost localhost.localdomain glusterfs01
10.1.1.2 gluster00
10.1.1.4 gluster02
## on gluster02
127.0.0.1 localhost localhost.localdomain glusterfs02
10.1.1.2 gluster00
10.1.1.3 gluster01
Installing glusterfs-server on your bricks (data nodes). In this example, on gluster00 and gluster01 :
apt-get update -y && apt-get install glusterfs-server -y
Connect on either node peer with the second host. In this example I'm connected on gluster00 :
gluster peer probe gluster01
Should give you something like this :
Number of Peers: 1
Hostname: gluster01
Uuid: 6474c4e6-2957-4de7-ac88-d670d4eb1320
State: Peer in Cluster (Connected)
Creating your storage volume
Now that you have both of your nodes created and in sync, you will need to create a volume that your clients will be able to use.
Syntax :
gluster volume create $VOL_NAME replica $NUMBER_OF_NODES transport tcp $DOMAIN_NAME1:/path/to/directory $DOMAIN_NAME2.com:/path/to/directory force
## actual syntax in for our example
gluster volume create testvolume replica 2 transport tcp glusterfs00:/gluster-volume glusterfs01:/gluster-volume force
Start the volume you have created :
gluster volume start testvolume
Configuring your client(s)
apt-get install glusterfs-client
Once completed, you will need to mount the storage that you previously created. First, make sure you have your mount point created :
mkdir /gluster-data
Mount your volume to your newly created mount point :
mount -t glusterfs gluster00:testvolume /gluster-data
Adding / Removing a brick from production
Once your node is ready with the proper packages and updates...
Make sure to edit its /etc/hosts and update every other nodes as well with your new entry :
echo "10.1.1.5 gluster03" >> /etc/hosts
Adding a new brick
Once you've completed the above points, simply connect on a node already part of the cluster :
gluster peer probe gluster03
And connect it to the volumes you want the new node to be connected to :
gluster volume add-brick testvolume replica 3 gluster03:/gluster-volum
Removing a clustered brick
Re-adding a node that has been previously removed