{"id":4597,"date":"2015-04-26T18:51:59","date_gmt":"2015-04-26T10:51:59","guid":{"rendered":"http:\/\/rmohan.com\/?p=4597"},"modified":"2015-04-26T18:51:59","modified_gmt":"2015-04-26T10:51:59","slug":"setting-up-a-2-node-glusterfs-file-system","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4597","title":{"rendered":"Setting up a 2-node GlusterFS file-system"},"content":{"rendered":"<p>This will be a quick howto on how you would set up a 2-node GlusterFS filesystem. You may look up more information at http:\/\/www.gluster.org\/.<\/p>\n<p>Volume types for GlusterFS<\/p>\n<p>\u2013 Distributed. Distributed volumes distributes files throughout the bricks in the volume<br \/>\n\u2013 Replicated. Replicated volumes replicates files across bricks in the volume<br \/>\n\u2013 Striped. Striped volumes stripes data across bricks in the volume<br \/>\n\u2013 Distributed Striped. Distributed striped volumes stripe data across two or more nodes in the cluster<br \/>\n\u2013 Distributed Replicated. Distributed replicated volumes distributes files across replicated bricks in the volume<br \/>\n\u2013 Distributed Striped Replicated. Distributed striped replicated volumes distributes striped data across replicated bricks in the cluster<br \/>\n\u2013 Striped Replicated. Striped replicated volumes stripes data across replicated bricks in the cluster<\/p>\n<p>The high level overview of how the process will be is as follows<br \/>\n\u2022Installing the required software<br \/>\n\u2022Disable or add proper firewall rules<br \/>\n\u2022Adding nodes into the cluster<br \/>\n\u2022Preparing \u201cbricks\u201d for use on each server<br \/>\n\u2022Creating and starting the actual GlusterFS volume<br \/>\n\u2022Mounting the GlusterFS volume<\/p>\n<p>Installing the required software<\/p>\n<p>I will be providing examples for CentOS, Fedora, Debian and Arch Linux. The examples for CentOS will work for RHEL and Scientific Linux as well.<br \/>\nCentOS<br \/>\nThe following command will install all dependencies.<br \/>\n# yum install glusterfs<\/p>\n<p>Fedora<br \/>\nThe following command will install all dependencies.<br \/>\n# yum install glusterfs-server<\/p>\n<p>Debian<br \/>\nThe following command will install all dependencies.<br \/>\n# apt-get install glusterfs-server<\/p>\n<p>Arch Linux<br \/>\nThe following command will install all dependencies.<br \/>\n# pacman -S glusterfs<\/p>\n<p>Disable or add proper firewall rules<\/p>\n<p>You will need to open the following ports for GlusterFS.<br \/>\n24007 \u2013 GlusterFS Daemon<br \/>\n24008 \u2013 Management<br \/>\n24009 &#8211; Each brick for every volume on your host requires it\u2019s own port. For every new brick, one new port will be used starting at 24009. (For GlusterFS versions earlier than 3.4)<br \/>\n49152 &#8211; Each brick for every volume on your host requires it\u2019s own port. For every new brick, one new port will be used starting at 49152 (GlusterFS 3.4 and later)<br \/>\n38465:38467 &#8211; This is required if you use the GlusterFS NFS service.<\/p>\n<p>CentOS<br \/>\nDisabling the default firewall<br \/>\n# chkconfig iptables off<br \/>\n# service stop iptables<\/p>\n<p>Fedora<br \/>\nsystemctl disable firewalld<br \/>\nsystemctl stop firewalld<\/p>\n<p>Debian<br \/>\nThere are no default firewall installed on Debian.<br \/>\nArch Linux<br \/>\nThere are no default firewall installed on Arch Linux.<\/p>\n<p>Adding nodes into the cluster<\/p>\n<p>This is incredibly easy. You may do the following command from either server. In my example I am on server1. If you don\u2019t have a solid DNS you should add each server to each others hosts file.<br \/>\n# gluster peer probe server2<br \/>\nProbe successful<\/p>\n<p>Preparing \u201cbricks\u201d for use on each server<\/p>\n<p>Nothing fanzy, you just need to create folders. It\u2019s also important to note that you will need to use a folder, even if you intended to use a single disk.<br \/>\nExecute the following on both of your servers<br \/>\n# mkdir -p \/data\/brick&gt;<\/p>\n<p>Creating and starting the actual GlusterFS volume<\/p>\n<p>Creating the GlusterFS volume<br \/>\nSyntax:<br \/>\ngluster volume create NEW-VOLNAME [replica COUNT] [transport [tcp | rdma | tcp,rdma]] NEW-BRICK&#8230;<\/p>\n<p>Example:<br \/>\n# gluster volume create test-volume replica 2 transport tcp server1:\/data\/brick server2:\/data\/brick<br \/>\nCreation of test-volume has been successful<br \/>\nPlease start the volume to access data.<\/p>\n<p>Starting the GlusterFS volume<br \/>\n# gluster volume start test-volume<\/p>\n<p>Mounting the GlusterFS volume<\/p>\n<p>It\u2019s important to note that you will need to mount the GlusterFS to use it. WARNING: Adding files directly to a brick will not be included in a GlusterFS volume.<br \/>\nSyntax:<br \/>\n# mount.glusterfs servername:volumename \/mnt\/mountpoint<\/p>\n<p>Examples:<br \/>\n# mount.glusterfs server1:test-volume \/mnt\/glusterfs\/<\/p>\n<p>OR<br \/>\n# mount -t glusterfs server1:test-volume \/mnt\/glusterfs\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will be a quick howto on how you would set up a 2-node GlusterFS filesystem. You may look up more information at http:\/\/www.gluster.org\/.<\/p>\n<p>Volume types for GlusterFS<\/p>\n<p>\u2013 Distributed. Distributed volumes distributes files throughout the bricks in the volume \u2013 Replicated. Replicated volumes replicates files across bricks in the volume \u2013 Striped. Striped volumes [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4597"}],"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=4597"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4597\/revisions"}],"predecessor-version":[{"id":4598,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4597\/revisions\/4598"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}