GlusterFS – Real Time Data Replication Across Multiple CentOS Nodes

Share this article with your friends

GlusterFS ?

GlusterFS is an open source  network / cluster filesystem and based on a stackable user space design.In this tutorials we will achieve high availability of storage(i.e real time replication of files) across two linux machines using GlusterFS.  Although glusterfs found its application in different areas like cloud computing, streaming media services, and content delivery networks. In this tutorials we will use the term brick  (It is the storage filesystem that has been assigned to a volume).

In Our case , we are using two Centos 6.2 Machines and Using glusterfs static files of Apache document root (/var/www/html)  will be replicated across these machine.  Follow the below steps to achieve this…

Step:1 Enable EPEL Repository on both the nodes
# yum -y install
Step: Enable glusterfs repository on both nodes
# wget -P /etc/yum.repos.d
Step:3 Install All the necessary Packages using yum  on both the nodes
# yum -y install pyxattr python-webob1.0 python-paste-deploy1.5 python-sphinx10 git autoconf automake bison dos2unix flex fuse-devel libaio-devel libibverbs-devel libtool libxml2-devel lvm2-devel make openssl-devel pkgconfig python-devel python-eventlet python-netifaces python-paste-deploy python-simplejson python-sphinx python-webob readline-devel rpm-build systemtap-sdt-devel tar
Step:4 Install the GlusterFS software on both nodes
#   yum install glusterfs{-fuse,-server}
#   yum install xfsdump xfsprogs
Step:5 Start glusterfs service  on both the nodes
# /etc/init.d/glusterd start ; chkconfig glusterd on
Step:6 Add fuse module to Linux core for GlusterClient on both the nodes.
# /sbin/modprobe fuse

To make it work after restart of server

# echo "modprobe fuse" > /etc/sysconfig/modules/fuse.modules
# chmod +x /etc/sysconfig/modules/fuse.modules
Step:7 Add Both nodes on trusted storage .

On ‘’ , run below command .

#gluster peer probe

On ‘’ , run below command

# gluster peer probe

Note: If we are using firewall, make sure TCP ports 111, 24007, 24008, 24009  are open on and

To Check status of trusted storage using below command :


Step:8 Create the below directory on both nodes.
#  mkdir -p /opt/gfs-data

On Master Node : , Run below command

# gluster volume create apache replica 2
Step:9 Now start the volume on both the nodes :
# gluster volume start apache

Now Mount volumes on :

# mount.glusterfs   /var/www/html

Also Mount the Volume on :

# mount.glusterfs site2.nextstep4it:/apache /var/www/html

For the Permanent Mount add below entry in the /etc/fstab file.   /var/www/html  glusterfs defaults,_netdev 0 0
Step:10 Testing of File replications

Go To /var/www/html folders  , modify the files from ‘’ check whether the changes are reflected on another node ‘’.

Free Download Linux e-Books

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *