GlusterFS
===============
Gluster File System is a distributed files system allowing you to create a single volume of storage which spans multiple disks,
multiple machines and even multiple data centres.
Install the required packages on both Ubuntu/CentOS machines. If have more than two servers,
perform this command on all of the servers required for the volume.
IP 192.168.1.20, hostname centos-gfs1
IP 192.168.1.21, hostname centos-gfs1
GlusterFS server installation
---------------------------------------------------------
On-CentOS
-------------------------
# cd /etc/yum.repos.d/
# wget http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/EPEL.repo/glusterfs-epel.repo
# yum install glusterfs-server
# chkconfig --level 235 glusterd on
On-Ubuntu
---------------------------
# apt-get install glusterfs-server
# glusterfs --version
Now it is mandatory that both machines must listen to each other with their hostname, so update both machines with the entries in /etc/hosts:
# vi /etc/hosts
192.168.1.20 centos-gfs1 gfs1
192.168.1.21 centos-gfs2 gfs2
#
Note:---Disable SELinux and iptables---
Now in both machines run the command gluster peer probe
run this on first machine as follows:
# gluster peer probe gfs1
# gluster peer probe gfs2
# gluster peer status
Again same thing repeat on second machine:
# gluster peer probe gfs1
# gluster peer probe gfs2
# gluster peer status
Now I will create a common folder on both machines.
# mkdir /GluFS
Run Below commands Only in One Machine
Now we need to create the volume where the data will reside.
The volume will be called datapoint. Now run on any machine:
# gluster volume create gfsv1 replica 2 transport tcp gfs1:/GluFS gfs2:/GluFS force
# gluster volume start gfsv1
Running either of the below commands should indicate that GlusterFS is up and running.
The ps command should show the command running with both servers in the argument.
netstat should show a connection between both nodes.
# ps aux | grep gluster
# netstat -tap | grep glusterfsd
As a final test, to make sure the volume is available, run gluster volume info. As shown below:
# gluster volume info
It shows that two bricks are fully functional.
Now we have a GlusterFS volume which will maintain replication across two nodes.
In the same way you can use N numbers of brick as nodes.
Install and Configure the Client Components
============================================
# yum install glusterfs-client
# apt-get install glusterfs-client
# mkdir /Test
# mount -t glusterfs centos-gfs1:/gfsv1 /Test
OR
# mount -t glusterfs 192.168.1.20:/gfsv1 /Test
Restrict Access to the Volume
===============================
Currently, any computer can connect to our storage volume without any restrictions.
We can change this by setting an option on our volume.
# gluster volume set gfsv1 auth.allow gluster_client1_ip,gluster_client2_ip
If you need to remove the restriction at any point
# gluster volume set gfsv1 auth.allow *
GlusterFS-Commands
======================
===============
Gluster File System is a distributed files system allowing you to create a single volume of storage which spans multiple disks,
multiple machines and even multiple data centres.
Install the required packages on both Ubuntu/CentOS machines. If have more than two servers,
perform this command on all of the servers required for the volume.
IP 192.168.1.20, hostname centos-gfs1
IP 192.168.1.21, hostname centos-gfs1
GlusterFS server installation
---------------------------------------------------------
On-CentOS
-------------------------
# cd /etc/yum.repos.d/
# wget http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/EPEL.repo/glusterfs-epel.repo
# yum install glusterfs-server
# chkconfig --level 235 glusterd on
On-Ubuntu
---------------------------
# apt-get install glusterfs-server
# glusterfs --version
Now it is mandatory that both machines must listen to each other with their hostname, so update both machines with the entries in /etc/hosts:
# vi /etc/hosts
192.168.1.20 centos-gfs1 gfs1
192.168.1.21 centos-gfs2 gfs2
#
Note:---Disable SELinux and iptables---
Now in both machines run the command gluster peer probe
run this on first machine as follows:
# gluster peer probe gfs1
# gluster peer probe gfs2
# gluster peer status
Again same thing repeat on second machine:
# gluster peer probe gfs1
# gluster peer probe gfs2
# gluster peer status
Now I will create a common folder on both machines.
# mkdir /GluFS
Run Below commands Only in One Machine
Now we need to create the volume where the data will reside.
The volume will be called datapoint. Now run on any machine:
# gluster volume create gfsv1 replica 2 transport tcp gfs1:/GluFS gfs2:/GluFS force
# gluster volume start gfsv1
Running either of the below commands should indicate that GlusterFS is up and running.
The ps command should show the command running with both servers in the argument.
netstat should show a connection between both nodes.
# ps aux | grep gluster
# netstat -tap | grep glusterfsd
As a final test, to make sure the volume is available, run gluster volume info. As shown below:
# gluster volume info
It shows that two bricks are fully functional.
Now we have a GlusterFS volume which will maintain replication across two nodes.
In the same way you can use N numbers of brick as nodes.
Install and Configure the Client Components
============================================
# yum install glusterfs-client
# apt-get install glusterfs-client
# mkdir /Test
# mount -t glusterfs centos-gfs1:/gfsv1 /Test
OR
# mount -t glusterfs 192.168.1.20:/gfsv1 /Test
Restrict Access to the Volume
===============================
Currently, any computer can connect to our storage volume without any restrictions.
We can change this by setting an option on our volume.
# gluster volume set gfsv1 auth.allow gluster_client1_ip,gluster_client2_ip
If you need to remove the restriction at any point
# gluster volume set gfsv1 auth.allow *
GlusterFS-Commands
======================