{"id":6953,"date":"2017-09-06T11:39:07","date_gmt":"2017-09-06T03:39:07","guid":{"rendered":"http:\/\/rmohan.com\/?p=6953"},"modified":"2017-09-06T11:39:07","modified_gmt":"2017-09-06T03:39:07","slug":"glusterfs-servers-on-rhel-7-and-centos-7-2","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6953","title":{"rendered":"GlusterFS servers on RHEL 7 and Centos 7"},"content":{"rendered":"<p><strong> GlusterFS servers on RHEL 7 and Centos 7<br \/>\n<\/strong><\/p>\n<p>vi \/etc\/hosts<\/p>\n<p>192.168.1.71 apache1.rmohan.com apache1<br \/>\n192.168.1.72 apache2.rmohan.com apache2<br \/>\n192.168.1.74 apache3.rmohan.com apache3<\/p>\n<p>For this lab, we disabled both firewall and SELinux<\/p>\n<p>vi \/etc\/selinux\/config<br \/>\negrep &#8220;^SELINUX=&#8221; \/etc\/sysconfig\/selinux<br \/>\nSELINUX=disabled<br \/>\nsystemctl is-enabled firewalld<br \/>\ndisabled<\/p>\n<p>systemctl disable firewalld<br \/>\nyum update<br \/>\nyum -y install wget openssh* net-tools ntp<br \/>\nntpdate -u 0.centos.pool.ntp.org<\/p>\n<p>Before proceeding with the installation, we need to enable both EPEL (Exta Packages for Enterprise Linux) and GlusterFS repositories on both the servers to resolve the external dependencies at the time of installation. If you have enabled only GlusterFS repository and not enabled EPEL repository then it is likely that you will hit the following error message while installing glusterfs-server:<br \/>\n&#8211;&gt; Finished Dependency Resolution<br \/>\nError: Package: glusterfs-server-3.7.11-1.el7.x86_64 (glusterfs-epel)<br \/>\nRequires: liburcu-cds.so.1()(64bit)<br \/>\nError: Package: glusterfs-server-3.7.11-1.el7.x86_64 (glusterfs-epel)<br \/>\nRequires: liburcu-bp.so.1()(64bit)<br \/>\nYou could try using &#8211;skip-broken to work around the problem<br \/>\nYou could try running: rpm -Va &#8211;nofiles &#8211;nodigest<\/p>\n<p>EPEL installation<br \/>\nRetrieve EPEL repository : all 3 servers<br \/>\nwget http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-7-6.noarch.rpm<\/p>\n<p>Gluster installation :<br \/>\nRetrieve GlusterFS repository : all 3 servers<br \/>\nwget -P \/etc\/yum.repos.d http:\/\/download.gluster.org\/pub\/gluster\/glusterfs\/LATEST\/RHEL\/glusterfs-epel.repo<\/p>\n<p>Download GlusterFS packages : all 3 servers<br \/>\nyum -y install glusterfs-server<\/p>\n<p>Now, start the service and keep it started across reboot :<br \/>\n[root@apache3 ~]# systemctl start glusterd &amp;&amp; systemctl enable glusterd<br \/>\nCreated symlink from \/etc\/systemd\/system\/multi-user.target.wants\/glusterd.service to \/usr\/lib\/systemd\/system\/glusterd.service.<br \/>\n[root@apache3 ~]#<\/p>\n<p>Update \u201c\/etc\/hosts\u201d :<br \/>\n192.168.1.71 apache1.rmohan.com apache1<br \/>\n192.168.1.72 apache2.rmohan.com apache2<br \/>\n192.168.1.74 apache3.rmohan.com apache3<\/p>\n<p>Check the 2 GlusterFS servers<\/p>\n<p>[root@apache1 ~]# gluster peer probe apache2<br \/>\npeer probe: success.<br \/>\n[root@apache1 ~]# gluster peer probe apache3<br \/>\npeer probe: success.<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache2 ~]# gluster peer probe apache3<br \/>\npeer probe: success. Host apache3 port 24007 already in peer list<br \/>\n[root@apache2 ~]# gluster peer probe apache1<br \/>\npeer probe: success. Host apache1 port 24007 already in peer list<br \/>\n[root@apache2 ~]#<\/p>\n<p>[root@apache3 ~]# gluster peer probe apache1<br \/>\npeer probe: success. Host apache1 port 24007 already in peer list<br \/>\n[root@apache3 ~]# gluster peer probe apache2<br \/>\npeer probe: success. Host apache2 port 24007 already in peer list<br \/>\n[root@apache3 ~]#<\/p>\n<p>Check the Peers :<br \/>\nroot@apache1 ~]# gluster peer status<br \/>\nNumber of Peers: 2<\/p>\n<p>Hostname: apache2<br \/>\nUuid: 09db776a-ab96-47a3-ad77-6bc77906566b<br \/>\nState: Peer in Cluster (Connected)<\/p>\n<p>Hostname: apache3<br \/>\nUuid: 14db2875-378d-481d-968c-552a10f2fd7e<br \/>\nState: Peer in Cluster (Connected)<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache2 ~]# gluster peer status<br \/>\nNumber of Peers: 2<\/p>\n<p>Hostname: apache1.rmohan.com<br \/>\nUuid: 16612fd4-8b94-4006-8ed7-24ac33c564e0<br \/>\nState: Peer in Cluster (Connected)<br \/>\nOther names:<br \/>\napache1<\/p>\n<p>Hostname: apache3<br \/>\nUuid: 14db2875-378d-481d-968c-552a10f2fd7e<br \/>\nState: Peer in Cluster (Connected)<\/p>\n<p>[root@apache3 ~]# gluster peer status<br \/>\nNumber of Peers: 2<\/p>\n<p>Hostname: apache1.rmohan.com<br \/>\nUuid: 16612fd4-8b94-4006-8ed7-24ac33c564e0<br \/>\nState: Peer in Cluster (Connected)<br \/>\nOther names:<br \/>\napache1<\/p>\n<p>Hostname: apache2<br \/>\nUuid: 09db776a-ab96-47a3-ad77-6bc77906566b<br \/>\nState: Peer in Cluster (Connected)<\/p>\n<p>Create GlusterFS volume<br \/>\nWe add 2 new drives from VMware ESXi (in fact, the 3 GlusterFS servers are 3 virtual machines) : do the below commands on all 3 servers<\/p>\n<p>[root@apache1 ~]# for HOST in $(ls \/sys\/class\/scsi_host) ; do echo &#8216;- &#8211; -&#8216;&gt;&#8221;\/sys\/class\/scsi_host\/$HOST\/scan&#8221; ; done<br \/>\n[root@apache1 ~]# lsblk -f<br \/>\nNAME FSTYPE LABEL UUID MOUNTPOINT<br \/>\nsda<br \/>\n??sda1 xfs be8c0a37-1ed9-4743-b4ef-03d59ba3d06d \/boot<br \/>\n??sda2 LVM2_member YXOIJV-EPlD-dXwg-ePQX-D7av-jPdr-Grb4rp<br \/>\n??centos-root xfs d2c46dc9-6365-4345-9b60-021aabfd0525 \/<br \/>\n??centos-swap swap 74c70324-6875-40e6-9d8f-591d3325c06e [SWAP]<br \/>\n??centos-home xfs bd8e9210-bc95-4af9-be87-a33da31f8dbb \/home<br \/>\nsdb<br \/>\nsr0 iso9660 CentOS 7 x86_64 2016-04-01-13-21-01-00<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache1 ~]# parted -s \/dev\/sdb mklabel gpt &amp;&amp; parted -s \/dev\/sdb mkpart primary xfs 0% 100% &amp;&amp; mkfs.xfs -f \/dev\/sdb<br \/>\nmeta-data=\/dev\/sdb isize=256 agcount=4, agsize=1310720 blks<br \/>\n= sectsz=512 attr=2, projid32bit=1<br \/>\n= crc=0 finobt=0<br \/>\ndata = bsize=4096 blocks=5242880, imaxpct=25<br \/>\n= sunit=0 swidth=0 blks<br \/>\nnaming =version 2 bsize=4096 ascii-ci=0 ftype=0<br \/>\nlog =internal log bsize=4096 blocks=2560, version=2<br \/>\n= sectsz=512 sunit=0 blks, lazy-count=1<br \/>\nrealtime =none extsz=4096 blocks=0, rtextents=0<br \/>\n[root@apache1 ~]#<\/p>\n<p>Create gluster and mount on all 3 nodes<\/p>\n<p>[root@apache1 ~]# mkdir \/gluster<br \/>\n[root@apache1 ~]# vi \/etc\/fstab<br \/>\n[root@apache1 ~]# grep -i gluster \/etc\/fstab<br \/>\n\/dev\/sdb \/gluster xfs defaults 0 0<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache1 ~]# mount -a<br \/>\n[root@apache1 ~]# df -Th<br \/>\nFilesystem Type Size Used Avail Use% Mounted on<br \/>\n\/dev\/mapper\/centos-root xfs 38G 1.2G 37G 3% \/<br \/>\ndevtmpfs devtmpfs 1.8G 0 1.8G 0% \/dev<br \/>\ntmpfs tmpfs 1.9G 0 1.9G 0% \/dev\/shm<br \/>\ntmpfs tmpfs 1.9G 8.6M 1.9G 1% \/run<br \/>\ntmpfs tmpfs 1.9G 0 1.9G 0% \/sys\/fs\/cgroup<br \/>\n\/dev\/sda1 xfs 497M 186M 312M 38% \/boot<br \/>\n\/dev\/mapper\/centos-home xfs 19G 33M 19G 1% \/home<br \/>\ntmpfs tmpfs 371M 0 371M 0% \/run\/user\/0<br \/>\n\/dev\/sdb xfs 20G 33M 20G 1% \/gluster<br \/>\n[root@apache1 ~]#<\/p>\n<p>Create a directory within the file system on the servers :<br \/>\nmkdir -p \/gluster\/briks<\/p>\n<p>Create the GlusterFS volume based on those 3 replicas :<\/p>\n<p>gluster volume create appgluster_vol replica 3 apache1:\/gluster\/briks apache2:\/gluster\/briks apache3:\/gluster\/briks<\/p>\n<p>[root@apache1 ~]# gluster volume create appgluster_vol replica 3 apache1:\/gluster\/briks apache2:\/gluster\/briks apache3:\/gluster\/briks<br \/>\nvolume create: appgluster_vol: success: please start the volume to access data<br \/>\n[root@apache1 ~]#<\/p>\n<p>Then, start this volume :<\/p>\n<p>[root@apache1 ~]# gluster volume start appgluster_vol<br \/>\nvolume start: appgluster_vol: success<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache1 ~]# gluster volume info<\/p>\n<p>Volume Name: appgluster_vol<br \/>\nType: Replicate<br \/>\nVolume ID: 856f1052-9d19-49ee-b0c1-1e53d32b86f4<br \/>\nStatus: Started<br \/>\nNumber of Bricks: 1 x 3 = 3<br \/>\nTransport-type: tcp<br \/>\nBricks:<br \/>\nBrick1: apache1:\/gluster\/briks<br \/>\nBrick2: apache2:\/gluster\/briks<br \/>\nBrick3: apache3:\/gluster\/briks<br \/>\nOptions Reconfigured:<br \/>\nperformance.readdir-ahead: on<br \/>\n[root@apache1 ~]#<\/p>\n<p>[root@apache1 ~]# gluster volume status<br \/>\nStatus of volume: appgluster_vol<br \/>\nGluster process TCP Port RDMA Port Online Pid<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nBrick apache1:\/gluster\/briks 49152 0 Y 3108<br \/>\nBrick apache2:\/gluster\/briks 49152 0 Y 2923<br \/>\nBrick apache3:\/gluster\/briks 49152 0 Y 2892<br \/>\nNFS Server on localhost 2049 0 Y 3128<br \/>\nSelf-heal Daemon on localhost N\/A N\/A Y 3136<br \/>\nNFS Server on apache2 2049 0 Y 2943<br \/>\nSelf-heal Daemon on apache2 N\/A N\/A Y 2951<br \/>\nNFS Server on apache3 2049 0 Y 2912<br \/>\nSelf-heal Daemon on apache3 N\/A N\/A Y 2920<\/p>\n<p>Task Status of Volume appgluster_vol<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nThere are no active volume tasks<\/p>\n<p>[root@apache1 ~]#<\/p>\n<p>Client side<br \/>\nBoth firewall and SELinux are disabled :<\/p>\n<p>192.168.1.21 clusterserver2.rmohan.com clusterserver2<br \/>\n192.168.1.26 clusterserver3.rmohan.com clusterserver3<\/p>\n<p>one the clinet side add the host file<br \/>\n192.168.1.21 clusterserver2.rmohan.com clusterserver2<br \/>\n192.168.1.26 clusterserver3.rmohan.com clusterserver3<br \/>\n192.168.1.71 apache1.rmohan.com apache1<br \/>\n192.168.1.72 apache2.rmohan.com apache2<br \/>\n192.168.1.74 apache3.rmohan.com apache3<\/p>\n<p>[root@clusterserver3 ~]# mount.glusterfs apache1:\/appgluster_vol \/mnt\/<br \/>\n[root@clusterserver3 ~]# df -Th<br \/>\nFilesystem Type Size Used Avail Use% Mounted on<br \/>\n\/dev\/mapper\/centos-root xfs 50G 3.6G 47G 8% \/<br \/>\ndevtmpfs devtmpfs 1.8G 0 1.8G 0% \/dev<br \/>\ntmpfs tmpfs 1.9G 16K 1.9G 1% \/dev\/shm<br \/>\ntmpfs tmpfs 1.9G 17M 1.8G 1% \/run<br \/>\ntmpfs tmpfs 1.9G 0 1.9G 0% \/sys\/fs\/cgroup<br \/>\n\/dev\/loop0 ext4 1.9G 6.1M 1.7G 1% \/srv\/node\/swiftloopback<br \/>\n\/dev\/mapper\/centos-home xfs 46G 33M 46G 1% \/home<br \/>\n\/dev\/sda1 xfs 497M 213M 285M 43% \/boot<br \/>\ntmpfs tmpfs 371M 0 371M 0% \/run\/user\/0<br \/>\napache1:\/appgluster_vol fuse.glusterfs 20G 33M 20G 1% \/mnt<br \/>\n[root@clusterserver3 ~]#<\/p>\n<p>[root@clusterserver3 ~]# echo &#8220;here is a GlusterFS file&#8221; &gt; \/mnt\/file<\/p>\n<p>[root@apache1 ~]# cat \/gluster\/briks\/file<br \/>\nhere is a GlusterFS file<\/p>\n<p>[root@apache2 ~]# cat \/gluster\/briks\/file<br \/>\nhere is a GlusterFS file<br \/>\n[root@apache2 ~]#<\/p>\n<p>[root@apache3 ~]# cat \/gluster\/briks\/file<br \/>\nhere is a GlusterFS file<br \/>\n[root@apache3 ~]#<\/p>\n","protected":false},"excerpt":{"rendered":"<p> GlusterFS servers on RHEL 7 and Centos 7 <\/p>\n<p>vi \/etc\/hosts<\/p>\n<p>192.168.1.71 apache1.rmohan.com apache1 192.168.1.72 apache2.rmohan.com apache2 192.168.1.74 apache3.rmohan.com apache3<\/p>\n<p>For this lab, we disabled both firewall and SELinux<\/p>\n<p>vi \/etc\/selinux\/config egrep &#8220;^SELINUX=&#8221; \/etc\/sysconfig\/selinux SELINUX=disabled systemctl is-enabled firewalld disabled<\/p>\n<p>systemctl disable firewalld yum update yum -y install wget openssh* net-tools ntp ntpdate -u 0.centos.pool.ntp.org<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6953"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6953"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6953\/revisions"}],"predecessor-version":[{"id":6954,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6953\/revisions\/6954"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}