GlusterFS is an open source server that realizes a distributed file system
and it’s developed by Gluster Inc., acquired by Redhat in September
2011. Using GlusterFS we can aggregate multiple servers and can use as
one file system.
This tutorial will show you how to setup GlusterFS with high availability
storage on two storage servers that usages GlusterFS. Each server will
be mirrored and replicate the data automatically across both storage
servers in real-time. It aggregates all storage bricks over Remote direct
memory access. And another one will be used as a client.
- Preparatory Note
I am going to use three systems in this tutorial, two systems will act as
server and one system will act as an client.
All these servers should be able to communicate with each other, either
we can configure DNS or we can do local host entry. In this tutorial I
have done the entry in hosts file on all three systems as below:
(Note: In this setup you can also directly use IP address, If you want to
directly use IP address then you don’t need to setup any DNS or hosts
entry. You can skip this hosts entry then, but if you want to resolve
hostname then you have to make this entry so that each hostnames
can communicate with each other)
These following commands in step 2, we will run on all three systems.
Import the GPG key for packages we will need following command
as below. Now we need to install EPEL open source repository version 7
using command as below.
Now we have to update priorities from repository in the epel
section so that we can install relevant versions of glusterFS.
Update priority=10 from /etc/yum.repos.d/epel.repo as showing
Now update the repository using yum command as below
Install and Configure GlusterFS Servers
These commands in step 3 we will use on only two systems server1 and
Before installing glusterFS we have to install centos repository as glusterfs
package is available in centos repository
Once the centos group repository gets installed using the above command, now
you can install glusterfs server using the following command.
Now we have to start the service and also need to enable service so that gluster
server can be started automatically after system boot.
You can check version of glusterFS using below command
If you have firewalld activated on your server, then make sure that all
below ports are allowed from there.
Or you can stop and disable that service using the command below.
Now we will work on server1 and will create peers, we will add
server2.glusterfs.com to storage pool running command on
On server1.glusterfs.com, run below command
Now in the status of storage pool information should be shown on
server2.glusterfs.com, to check status of trusted storage pool, you can
run below command.
Now we will create a volume using name glustvol with 2 replicas (We
are using 2 replicas here because we have two storage servers in this
tutorial, replica should be equal to number of storage servers we are
using) on server1 and server2 for /glustdata folder (We have to create
You can create directory using below command on both server1 and
Once the directory is created you can use the command below to
create volume for /glustdata with server1 and server2.
Now start the volume using command:
Now check the volume information using below command
Configure the GlusterFS Client
Now we will install and configure GlusterFS client on client machine,
now we will run all commands written in step 4 on client.glusterfs.com
Install glusterfs-client using the command below.
Now we will create a directory on client machine using below command
Now we are almost done, we have to only mount that volume
“glustvol” on the client machine which we created as a trusted storage
pool on server1 to /home/glustdir.
We can use the command below to mount the same.
The above command is only use to mount for temporary, if you want to
mount for permanent, then we have to update entry in “/etc/rc.local”
Then reboot the server using “reboot” command
Once the mount process is completed, we will go to Testing process.
Now let’s create some test files under /home/glustdir on client machine
Now let’s check glustdata directory on server1.glusterfs.com and
server2.glusterfs.com, these files should be available there, you can list
the directory using the command below.