{"id":445,"date":"2015-01-28T16:40:16","date_gmt":"2015-01-28T16:40:16","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=445"},"modified":"2022-10-21T11:54:06","modified_gmt":"2022-10-21T11:54:06","slug":"how-to-setup-glusterfs-serverclient","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/how-to-setup-glusterfs-serverclient\/","title":{"rendered":"How to setup GlusterFS Server\/Client"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\"><strong>Gluster setup Server\/client on both nodes<\/strong><\/span><\/p>\n<p><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;On both machines:<\/strong><\/p>\n<ul>\n<li><em>wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-3.4.0-8.el6.x86_64.rpm<\/em><\/li>\n<li><em>wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-fuse-3.4.0-8.el6.x86_64.rpm<\/em><\/li>\n<li><em>wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-server-3.4.0-8.el6.x86_64.rpm<\/em><\/li>\n<li><em>wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-libs-3.4.0-8.el6.x86_64.rpm<\/em><\/li>\n<li><em><\/em><em>wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-cli-3.4.0-8.el6.x86_64.rpm<br \/>\n<\/em><br \/>\n<strong>Install GlusterFS Server and Client<\/strong><\/li>\n<li><em>yum localinstall -y gluster*.rpm<\/em><\/li>\n<li><em>yum install fuse<\/em><\/li>\n<\/ul>\n<p>We want to use LVM for the glusterfs, so if we need to increase the size of the volume in future we can do so relatively easily. Repeat these steps on both nodes.<\/p>\n<p><strong>Create your physical volume<\/strong><\/p>\n<ul>\n<li><em>pvcreate \/dev\/sdb<\/em><\/li>\n<\/ul>\n<p><strong>Create your volume<\/strong><\/p>\n<ul>\n<li><em>vgcreate vg_gluster \/dev\/sdb<\/em><\/li>\n<\/ul>\n<p><strong>Create the logical volume<\/strong><\/p>\n<ul>\n<li><em>lvcreate -l100%VG -n lv_gluster vg_gluster<\/em><\/li>\n<\/ul>\n<p><strong>Format your volume<\/strong><\/p>\n<ul>\n<li><em>mkfs.ext3 \/dev\/vg_gluster\/lv_gluster<\/em><\/li>\n<\/ul>\n<p><strong>Make the directory for your glusterfs<\/strong><\/p>\n<ul>\n<li><em>mkdir -p \/mnt\/lv_gluster<\/em><\/li>\n<\/ul>\n<p><strong>Mount the logical volume to your destination<\/strong><\/p>\n<ul>\n<li><em>mount \/dev\/vg_gluster\/lv_gluster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\/mnt\/lv_gluster<\/em><\/li>\n<\/ul>\n<p><strong>Create your brick<\/strong><\/p>\n<ul>\n<li><em>mkdir -p \/mnt\/lv_gluster\/brick<\/em><\/li>\n<\/ul>\n<p><strong>Add to your fstab if you wish for it to automount upon reboots<\/strong><\/p>\n<ul>\n<li><em>echo &#8220;&#8221;&nbsp; &gt;&gt; \/etc\/fstab<\/em><\/li>\n<li><em>echo &#8220;\/dev\/vg_glusterfs\/lv_gluster \/mnt\/lv_gluster ext3 defaults 0 0&#8221;&nbsp; &gt;&gt; \/etc\/fstab<\/em><\/li>\n<li><em>service glusterd start<\/em><\/li>\n<li><em>chkconfig glusterd on<\/em><\/li>\n<\/ul>\n<p>Now from server1.nicktailor.com:<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Test to ensure you can contact your second node<\/strong><\/p>\n<ul>\n<li><em>gluster peer probe server2.nicktailor.com<\/em><\/li>\n<\/ul>\n<p><strong>Create glusterfs volume name and replication between both nodes<\/strong><\/p>\n<ul>\n<li><em>gluster volume create $volumename replica 2 transport tcp<br \/>\nserver1.nicktailor.com:\/mnt\/lv_gluster\/brick server2.nicktailor.com:\/mnt\/lv_gluster\/brick<\/em><\/li>\n<\/ul>\n<p><strong>Start the glusterfs volume<\/strong><\/p>\n<ul>\n<li><em>gluster volume start $volumename<\/em><\/li>\n<\/ul>\n<p>Now on server1.nicktailor.com:<\/p>\n<p>Now we need to make the glusterfs directory from which everything will write to and replicate from.<\/p>\n<p><strong>NOTE: You will not be able to mount the storage unless your glusterfs volume is started&nbsp;<\/strong><\/p>\n<ul>\n<li><em>mkdir \/storage<\/em><\/li>\n<li><em>mount -t glusterfs server1.nicktailor.com:\/sftp \/storage&nbsp;<\/em><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Add to these lines for automounting upon reboots<\/strong><\/p>\n<ul>\n<li><em>echo &#8220;&#8221;&nbsp; &gt;&gt; \/etc\/fstab<\/em><\/li>\n<li><em>echo &#8220;glusterfs server1.nicktailor.com:\/sftp \/storage glusterfs defaults,_netdev 0 0&#8221;&nbsp; &gt;&gt; \/etc\/fstab<\/em><\/li>\n<li><em>echo &#8220;&#8221;&nbsp; &gt;&gt; \/etc\/rc.local<\/em><\/li>\n<li><em style=\"color: #000000;\">echo &#8220;grep -v &#8216;^\\s*#&#8217; \/etc\/fstab | awk &#8216;{if (\\$3 == \\&#8221;glusterfs\\&#8221;) print \\$2}&#8217; | xargs mount&#8221;&nbsp; &gt;&gt; \/etc\/rc.local<\/em><\/li>\n<li><i style=\"color: #000000;\">echo &#8220;<\/i><em style=\"color: #000000;\">mount -t glusterfs&nbsp;<\/em><em>server1.nicktailor.com<\/em>:\/sftp \/storage&#8221; &gt;&gt; \/etc\/rc.local<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Now on server2.nicktailor.com do the following after you install the glusterfs and setup the volume group and start the glusterfs service<\/strong><\/p>\n<ul>\n<li><em>mkdir \/storage<\/em><\/li>\n<li><em>mount -t glusterfs <\/em><em>server2.nicktailor.com<\/em>:\/sftp \/storage<\/li>\n<li><em>echo &#8220;&#8221;&nbsp; &gt;&gt; \/etc\/fstab<\/em><\/li>\n<li><em>echo &#8221; server2.nicktailor.com:\/sftp \/storage glusterfs defaults 0 0&#8243;&nbsp; &gt;&gt; \/etc\/fstab&nbsp;<strong>(if this doesnt automount use the mount -t line at the bottom in \/etc\/rc.local instead)<\/strong><\/em><\/li>\n<li><em>echo &#8220;&#8221;&nbsp; &gt;&gt; \/etc\/rc.local<\/em><\/li>\n<li><em style=\"color: #000000;\"><\/em><em>echo &#8220;grep -v &#8216;^\\s*#&#8217; \/etc\/fstab | awk &#8216;{if (\\$3 == \\&#8221;glusterfs\\&#8221;) print \\$2}&#8217; | xargs mount&#8221;&nbsp; &gt;&gt; \/etc\/rc.local<\/em><\/li>\n<li><i><\/i><i>echo &#8220;<\/i><em style=\"color: #000000;\">mount -t glusterfs&nbsp;<\/em><em>server2.nicktailor.com<\/em>:\/sftp \/storage&#8221; &gt;&gt; \/etc\/rc.local<\/li>\n<\/ul>\n<p>CheersNick Tailor<\/p>\n<p>If you have questions email nick@nicktailor.com and I will try to answer as soon as I can.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gluster setup Server\/client on both nodes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;On both machines: wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-3.4.0-8.el6.x86_64.rpm wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-fuse-3.4.0-8.el6.x86_64.rpm wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-server-3.4.0-8.el6.x86_64.rpm wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-libs-3.4.0-8.el6.x86_64.rpm wget https:\/\/www.nicktailor.com\/files\/redhat6\/glusterfs-cli-3.4.0-8.el6.x86_64.rpm Install GlusterFS Server and Client yum localinstall -y gluster*.rpm yum install fuse We want to use LVM for the glusterfs, so if we need to increase the size of<a href=\"https:\/\/nicktailor.com\/tech-blog\/how-to-setup-glusterfs-serverclient\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,138],"tags":[],"class_list":["post-445","post","type-post","status-publish","format-standard","hentry","category-glusterfs","category-linux"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=445"}],"version-history":[{"count":23,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/445\/revisions"}],"predecessor-version":[{"id":1615,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/445\/revisions\/1615"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}