Professional Documents
Culture Documents
Install and Configure GlusterFS On CentOS 7
Install and Configure GlusterFS On CentOS 7
7 / RHEL 7
RAJ SEPTEMBER 29, 2016 0 COMMENTS CENTOS 7, GLUSTERFS, UBUNTU 16.04
In the technology world, it is always crucial to keep the data highly available to ensure it is
accessible to the application/user. High availability is achieved here by distributing the data
across the multiple volumes/nodes.
Client machines/users can access the storage as like local storage. Whenever the user
creates data on the Gluster storage, the data will be mirrored/distributed to other storage
nodes.
What is GlusterFS?
GlusterFS is an open-source, scalable network filesystem suitable for high data-intensive
workloads such as media streaming, cloud storage, and CDN (Content Delivery Network).
GlusterFS was developed initially by Gluster Inc, and then by Redhat, as a result of the
acquisition.
Terminologies:
Below are the important terminologies we use throughout this article.
Brick is basic storage (directory) on a server in the trusted storage pool.
Volumes:
As said earlier, the volume is the collection of bricks, and most of the gluster operations
such as reading and writing happen on the volume. GlusterFS supports different types of
volumes based on the requirements; suitable for scaling the storage size or improving the
performance or for both.
In this article, we will configure a replicated GlusterFS volume on CentOS 7 / RHEL 7.
Replicated Glusterfs Volume is like a RAID 1, and volume maintains exact copies of the
data on all bricks. You can decide the number of replicas while creating the volume, so you
would need to have atleast two bricks to create a volume with two replicas or three bricks to
create a volume of 3 replicas.
This volume provides better data reliability and data redundancy.
Why not read about remaining types of GlusterFS volumes.
Requirements:
Here, we are going to configure GlusterFS volume with two replicas. Make sure you have
two 64bit systems (either virtual or physical) with 1GB of memory, and one spare hard disk
on each system.
HOST NAME
IP ADDRESS
OS
MEMORY
DISK
PURPOSE
gluster1.itzgeek.local
192.168.12.16
CentOS 7
1GB
/dev/sdb (5GB)
Storage Node 1
gluster2.itzgeek.local
192.168.12.17
RHEL 7
1GB
/dev/sdb (5GB)
Storage Node 2
client.itzgeek.local
192.168.12.8
Ubuntu 16.04
NA
NA
Client Machine
For a demonstration, I am using different Linux distribution for each storage node here. I
recommend you to use a single Linux distribution across the cluster which will be easier
for you to troubleshoot the issues that arise in production.
Configure DNS:
GlusterFS components use DNS for name resolutions, so configure either DNS or set up a
hosts entry. If you do not have a DNS on your environment, modify /etc/hosts file and
update it accordingly.
sudo vi /etc/hosts
192.168.12.16 gluster1.itzgeek.local gluster1
192.168.12.17 gluster2.itzgeek.local gluster2
192.168.12.20 client.itzgeek.local client
RHEL 7:
Add Gluster repository on RHEL 7.
vi /etc/yum.repos.d/Gluster.repo
[gluster38]
name=Gluster 3.8
baseurl=http://mirror.centos.org/centos/7/storage/$basearch/gluster-3.8/
gpgcheck=0
enabled=1
CentOS 7:
Install centos-release-gluster package, it provides you the required YUM repository files.
This RPM is available from CentOS Extras.
yum install -y centos-release-gluster
Install GlusterFS:
Once you have added the repository on your systems, we are good to go for the installation
of GlusterFS. Install GlusterFS package using the following command.
yum install -y glusterfs-server
Configure Firewall:
You would need to either disable the firewall or configure the firewall to allow all
connections within a cluster.
By default, glusterd will listen on tcp/24007 but opening that port is not enough on the
gluster nodes. Each time you will add a brick , it will open a new port (that youll be able
to see with gluster volumes status)
# Disable FirewallD
systemctl stop firewalld
systemctl disable firewalld
OR
# Run below command on a node in which you want to accept all traffics comming
from the source ip
firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source
address="<ipaddress>" accept'
firewall-cmd --reload
Add Storage:
Assuming that you have one spare hard disk on your machine, /dev/sdb is the one I will
use here for a brick. Create a single partition on the spare hard disk shown like below.
You would need to perform the below steps on both nodes.
fdisk /dev/sdb
Add an entry to /etc/fstab for keeping the mount persistent across reboot.
echo "/dev/sdb1 /data/gluster ext4 defaults 0 0" | tee --append /etc/fstab
PAGES: 1 2