{"id":6605,"date":"2017-04-06T23:16:11","date_gmt":"2017-04-06T15:16:11","guid":{"rendered":"http:\/\/rmohan.com\/?p=6605"},"modified":"2017-04-06T23:18:09","modified_gmt":"2017-04-06T15:18:09","slug":"glusterfs-and-nfs-with-high-availability-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6605","title":{"rendered":"GlusterFS and NFS with High Availability on CentOS 7"},"content":{"rendered":"<p><strong>GlusterFS and NFS with High Availability on CentOS 7<\/strong><\/p>\n<p>GlusterFS and NFS with High Availability on CentOS 7<br \/>\nTechnical requirements<br \/>\n3 x CentOS 7 Machines<br \/>\n4 IP\u2019s<br \/>\nAdditional hard drive for each machine with same size. (eg : \/dev\/sdb )<br \/>\nDisable SELinux<\/p>\n<p>Installation<br \/>\nInstall CentOS 7 Minimal on 3 machines and give static IP\u2019s .<br \/>\nnode1.rmohan.com = 192.168.1.10<br \/>\nnode2.rmohan.com = 192.168.1.11<br \/>\nnode3.rmohan.com = 192.168.1.12<\/p>\n<p>Add hostnames on \/etc\/hosts file .<\/p>\n<p>Install GlusterFS packages on all servers.<\/p>\n<p># yum install centos-release-gluster \u2013y<br \/>\n# yum install glusterfs-server \u2013y<br \/>\n# systemctl start glusterd<br \/>\n# systemctl enable glusterd<\/p>\n<p>Create partition,<\/p>\n<p># fdisk \/dev\/sdb<br \/>\n# mkfs.ext4 \/dev\/sdb1<br \/>\n# mkdir \/data<br \/>\n# mount \/dev\/sdb1 \/data (Add this to \/etc\/fstab)<br \/>\n# mkdir \/data\/br0<\/p>\n<p>Configure GlusterFS,<\/p>\n<p>node1# gluster peer probe node2<br \/>\nnode1# gluster peer probe node3<br \/>\nnode1# gluster volume create br0 replica 3 node1:\/data\/br0 node2:\/data\/br0 node3:\/data\/br0<br \/>\nnode1# gluster volume start br0<br \/>\nnode1# gluster volume info br0<br \/>\nnode1# gluster volume set br0 nfs.disable off<\/p>\n<p>Install and Configure HA<\/p>\n<p>Install below packages on all servers,<\/p>\n<p># yum -y install corosync pacemaker pcs<br \/>\n# systemctl enable pcsd.service<br \/>\n# systemctl start pcsd.service<br \/>\n# systemctl enable corosync.service<br \/>\n# systemctl enable pacemaker.service<\/p>\n<p>These packages will create \u201chacluster\u201d user on all machines. We need to assign password for this user and it must be same on all servers.<\/p>\n<p>node1# passwd hacluster<br \/>\nnode2# passwd hacluster<br \/>\nnode3# passwd hacluster<\/p>\n<p>And run below command\u2019s on a single server,<\/p>\n<p>node1# pcs cluster auth node1 node2 node3<br \/>\nnode1# pcs cluster setup \u2013name NFS node1 node2 node3<br \/>\nnode1# pcs cluster start \u2013all<br \/>\nnode1# pcs property set no-quorum-policy=ignore<br \/>\nnode1# pcs property set stonith-enabled=false<\/p>\n<p>Create virtual heartbeat IP resource,<\/p>\n<p>node1# pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.1.13 cidr_netmask=24 op monitor interval=20s<br \/>\nnode1# pcs status<\/p>\n<p>Done.<\/p>\n<p>Client Configuration<\/p>\n<p>client# yum install nfs-utils \u2013y<br \/>\nclient# mount -o mountproto=tcp -t nfs 192.168.1.13:\/br0 \/gluster<\/p>\n<p>Disaster Recovery<\/p>\n<p>If a glusterFS server goes down,<br \/>\nAssume Node2 goes down, after repairing all things we need to start that machine.<br \/>\nnode2# pcs cluster start node2<br \/>\nnode2# pcs status<br \/>\nThis commands will automatically joins lost machine to existing PCS cluster.<br \/>\nAlso check gluster Auto healer,<br \/>\nnode2# gluster volume heal br0 info<br \/>\nNote : If 2 machines goes down, left over machine will act as read only file system. Need at least 2 live machines .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GlusterFS and NFS with High Availability on CentOS 7<\/p>\n<p>GlusterFS and NFS with High Availability on CentOS 7 Technical requirements 3 x CentOS 7 Machines 4 IP\u2019s Additional hard drive for each machine with same size. (eg : \/dev\/sdb ) Disable SELinux<\/p>\n<p>Installation Install CentOS 7 Minimal on 3 machines and give static IP\u2019s . [&#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\/6605"}],"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=6605"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6605\/revisions"}],"predecessor-version":[{"id":6607,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6605\/revisions\/6607"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}