Install GlusterFS on Centos7
In this tutorial I use 3 systems (2 servers and a client) with 2 server with Centos7 and 1 client with docker gluster/gluster-centos
- IP address 192.168.1.9 (node A)
- IP address 192.168.1.10 (node B)
- IP address 192.168.1.35 (client)
Install GlusterFS on both nodes
First, we need to import the GPG keys on each server and enable the EPEL 7 repository:rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
yum -y install yum-priorities
add the line priority=10 to the [epel] on /etc/yum.repos.d/epel.repo
:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
priority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[...]
Then update on existing packages on the system:yum -y update
After the package is installed, let’s install the repoyum -y install centos-release-gluster
yum -y install glusterfs-server
If you got a trouble when installing glusterfs-server and it says Requires: liburcu-cds.so.6()(64bit) or Requires: liburcu-bp.so.6()(64bit), try to install userspace-rcu. Since I’m using centos 7 with x86_64 architecture, I run this command
yum -y install http://mirror.centos.org/centos/7.9.2009/storage/x86_64/gluster-9/Packages/u/userspace-rcu-0.10.0-3.el7.x86_64.rpm
Start gluster service:systemctl start glusterd.service
Open some ports in firewall config:
firewall-cmd --zone=public --add-port=24007-24008/tcp --permanentfirewall-cmd --zone=public --add-port=24009/tcp --permanentfirewall-cmd --zone=public --add-service=nfs --add-service=samba --add-service=samba-client --permanentfirewall-cmd --zone=public --add-port=111/tcp --add-port=139/tcp --add-port=445/tcp --add-port=965/tcp --add-port=2049/tcp --add-port=38465-38469/tcp --add-port=631/tcp --add-port=111/udp --add-port=963/udp --add-port=49152-49251/tcp --permanentfirewall-cmd --reload
Let’s configure node Agluster peer probe 192.168.1.10
Check the status by command:gluster peer status
Now, create the gluster volume named testvol with two replicas on 192.168.1.9 and 192.168.1.10 in the /gluster-data directory
gluster volume create testvol replica 2 transport tcp 192.168.1.9:/gluster-data 192.168.1.10:/gluster-data force
Start the volumegluster volume start testvol
Then check both node info bygluster volume info
It gonna be like this
Setting up gluster client
In this tutorial, I using the OSX system with docker installed. So I just need to pull the gluster fs docker image
docker pull gluster/gluster-centos
then, start the container and mount to server A into /mnt/glusterfs
mount.glusterfs 192.168.1.9:/testvol /mnt/glusterfs
mount the volume and check it with df -h
and voila! you’re mounted into gluster-server. try to write some file in folder /mnt/glusterfs from client, then check on /gluster-data both on gluster server