How To Setup A Replicated GlusterFS Cluster On AWS EC2- Google Cloud Platform -Azure


GlusterFS  is one of the best open source distributed file systems. If you want a highly available distributed file system for your applications, GlusterFs is one of the good options.

Now: AWS offers a managed scalable file storage called Elastic File System. If you don’t want the administrative overhead of glusterFS clusters, you can give EFS a try.

GlusterFS Cluster On AWS Ec2

This guide covers all the necessary steps to setup a GlusterFs cluster using ec2 instances and extra EBS volumes. Here we are setting up a two node cluster, however, you can increase the node count based on your needs.

Instance Configurations

1. Create two instances with extra EBS volumes.

2. Make sure the instances can talk to each other.

3. Login to the servers and set the hostnames as node1 and node2 using the following commands.

Run bash on the terminal for the hostname to show up.

4. Make an entry in the /etc/hosts file with the IP and hostname of both servers as shown below. The IP’s should be resolvable using the hostnames. Change the IP in the following to your server IP’s.

Instance Port Configuration

You need to open the following ports int he ec2 security groups as well the server firewall if it is enabled.

Create Mount Points For EBS Volumes

You need to do the following in both the ec2 instances. 1. Format the volume to xfs.

xvdb is the name of the EBS volume. You can list the available devices using lsblkcommand.

2. Create a mount directory named /gshare and mount the formated volume.

3. Add the mount to /etc/fstab

GlusterFS Installation

Perform the following steps on both the servers.

1. Create a GlusterFs repo.

Copy the following to the repo file.

2. Install GlusterFS server.

3. Start and verify the glusterd service.

GlusterFs Configuration

1. Form node1 execute the following command to create a trusted storage pool with node2.

After successful execution, you would get peer probe: success. as output.

2. Check the peer status using the following command.

3. Create a data directory on gshare mount on both the servers.

4. Create a GlusterFS HA shared volume.

5. Start the gdata volume.

6. By default NFS is disabled. If you want NFS functionality for glusterFs volume, you can enable it using the following command.

7. Set the volume permissions for gdata volume for client access. Here I am using 172.* CIDR. You need to replace it based on your network range.

7. To get all the info about the volume, execute the following command.

GlusterFS Client Setup

1. Enable fuse kernel module.

2. Install all the glusterFS client dependencies.

3. Install the GlusterFS client.

GlusterFS Client Configuration

The data will get replicated only if you are writing from a GlusterFS client. You can mount the GlusterFS volume to any number of clients. We highly recommend you to map the gluster nodes to a domain name and use it with the clients for mounting.

Note A client machine is not part of the glusterFS cluster. It is the machine in which you want to mount the replicated volume.

1. Create a client mount directory.

2. Mount gfdata directory to the glusterFS replicated volume.

Troubleshooting GlusterFs

1. You can view all the logs of gluserFS server on the following directory.

To monitor logs in real time you can use tail -f along with the path to log file.
2. All glusterfs client logs are saved in the following with the volume name.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.