{"id":2567,"date":"2016-08-24T15:09:09","date_gmt":"2016-08-24T19:09:09","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2567"},"modified":"2018-01-12T13:55:05","modified_gmt":"2018-01-12T18:55:05","slug":"replicate-storage-across-servers-glusterfs-ubuntu-16","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/","title":{"rendered":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16"},"content":{"rendered":"<h1>How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16<\/h1>\n<p>GlusterFS is a file system specifically for network-attached storage. It&#8217;s highly suitable for applications that involve the cloud and for content delivery, such as streaming music and video. GlusterFS is free and open source under the GNU General Public License version 3.<\/p>\n<h2>Getting started<\/h2>\n<p>To install GlusterFS, you will need the following:<br \/>\n\u2022\t1 Web Server (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) (WAN + LAN)<br \/>\n\u2022\t2 Storage Server with the same configuration (LAN only)<\/p>\n<h2>Tutorial<\/h2>\n<p>This tutorial will guide you through setting up a shared document root for a web server. Even so, the principles are the same for setting up any other scenario where you wish to share storage between Linux boxes.<\/p>\n<p>Our network setup for this example will look as follows:<br \/>\n \u2022 web1: 10.0.0.47<br \/>\n \u2022 gluster1: 10.0.0.48<br \/>\n \u2022 gluster2: 10.0.0.49<\/p>\n<p>Open each GlusterFS node and web server hosts file in a text editor, so that you can set the hostname properly.<\/p>\n<p><code>nano \/etc\/hosts<\/code><br \/>\n<code class=\"gris\">10.0.0.48\tgluster1<br \/>\n10.0.0.49\tgluster2<\/code><\/p>\n<p>Next, create the directory that will be used as storage. This directory will be mounted to the web server on each gluster node.<\/p>\n<p><code>mkdir \/data<\/code><\/p>\n<p>Install GlusterFS on each gluster node. Enable it to load on server boot.<\/p>\n<p><code>apt-get install glusterfs-server<br \/>\nsystemctl enable glusterfs-server.service<\/code><\/p>\n<p>On gluster1, peer the second node.<\/p>\n<p><code>gluster peer probe gluster2<\/code><\/p>\n<p><code class=\"gris\">peer probe: success.<\/code><\/p>\n<p>Still on gluster1, display the status of the trusted storage pool.<\/p>\n<p><code>gluster peer status<\/code><\/p>\n<p><code class=\"gris\">Number of Peers: 1<br \/>\nHostname: gluster2<br \/>\nUuid: d8120e15-f91d-44ba-94bd-f808d4a75653<br \/>\nState: Peer in Cluster (Connected)<\/code><\/p>\n<p>Create the brick directory on each gluster node.<\/p>\n<p>Gluster1:<\/p>\n<p><code>mkdir \/data\/brick1<\/code><\/p>\n<p>Gluster2:<\/p>\n<p><code>mkdir \/data\/brick2<\/code><\/p>\n<p>On gluster1 again, create your storage volume and the replication<\/p>\n<p><code>gluster volume create glustervol1 replica 2 transport tcp gluster1:\/data\/brick1 gluster2:\/data\/brick2 force<\/code><\/p>\n<p>Caveat: You must use &#8220;force&#8221; at the end of the command if the volume is created on the same disk as the system disk (sda). If you are using a second disk for the volume (sdb) you will not need to force the creation of the storage volume.<\/p>\n<p><code>volume create: glustervol1: success: please start the volume to access data<\/code><\/p>\n<p>Start the storage volume on gluster1.<\/p>\n<p><code>gluster volume start glustervol1<\/code><\/p>\n<p><code class=\"gris\">volume start: glustervol1: success<\/code><\/p>\n<p>Now grant volume access to the local IP range.<\/p>\n<p><code>gluster volume set glustervol1 auth.allow 10.0.0.*<\/code><\/p>\n<p><code class=\"gris\">volume set: success<\/code><\/p>\n<p>You should be done with storage volume setup. Display the status of the storage volume.<\/p>\n<p><code>gluster volume info<\/code><\/p>\n<p><code class=\"gris\">Volume Name: glustervol1<br \/>\nType: Replicate<br \/>\nVolume ID: 2841e01a-8548-4009-86c2-c67ed3bc67da<br \/>\nStatus: Started<br \/>\nNumber of Bricks: 1 x 2 = 2<br \/>\nTransport-type: tcp<br \/>\nBricks:<br \/>\nBrick1: gluster1:\/data\/brick1<br \/>\nBrick2: gluster2:\/data\/brick2<br \/>\nOptions Reconfigured:<br \/>\nauth.allow: 10.0.0.*<\/code><\/p>\n<p>You can also now enable some fine tuning of the GlusterFS.<\/p>\n<p><code>gluster volume set glustervol1 performance.write-behind off<br \/>\ngluster volume set glustervol1 performance.io-thread-count 64<br \/>\ngluster volume set glustervol1 network.ping-timeout \"5\"<br \/>\ngluster volume set glustervol1 performance.write-behind-window-size 524288<br \/>\ngluster volume set glustervol1 performance.cache-refresh-timeout 1<\/code><\/p>\n<p>Now it&#8217;s time to set up the web server. Install the basic web server package on your web1 and glusterfs-client.<\/p>\n<p><code>apt-get install apache2 -y<br \/>\napt-get install glusterfs-client -y<br \/>\napt-get install attr -y<\/code><\/p>\n<p>Mount the GlusterFS filesystem on your Web1, which is \/var\/www\/html\/ in this case.<\/p>\n<p><code>mount.glusterfs gluster1:\/glustervol1 \/var\/www\/html\/<\/code><\/p>\n<p>Confirm that the GlusterFS filesystem is mounted on your web1.<\/p>\n<p><code>mount | grep glusterfs<\/code><\/p>\n<p><code class=\"gris\">gluster1:\/glustervol1 on \/var\/www\/html type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)<\/code><\/p>\n<p>Add the mount entry to \/etc\/fstab on your webserver.<\/p>\n<p><code>nano \/etc\/fstab<\/code><\/p>\n<p>add this line at the end :<\/p>\n<p><code class=\"gris\">gluster1:\/glustervol1      \/var\/www\/html                glusterfs defaults,_netdev,direct-io-mode=disable 0 0<\/code><\/p>\n<p>Let&#8217;s test the replication. Create a file on your webserver (web1) in the document root directory.<\/p>\n<p><code>cd \/var\/www\/html<br \/>\ntouch index.html<\/code><\/p>\n<p>Check in both gluster node if the file exist.<\/p>\n<p>Gluster1: <\/p>\n<p><code>ls \/data\/brick1<br \/>\nindex.html<\/code><\/p>\n<p>Gluster2:<\/p>\n<p><code>ls \/data\/brick2<br \/>\nindex.html<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>You should have GlusterFS successfully installed now. Experiment to see how it can best help your workflow and projects. If you found this article helpful, feel free to share it with your friends and let us know in the comments below!<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 GlusterFS is a file system specifically for network-attached storage. It&#8217;s highly suitable for applications that involve the cloud and for content delivery, such as streaming music and video. GlusterFS is free and open source under the GNU General Public License version 3. Getting started<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71,75],"tags":[],"class_list":["post-2567","post","type-post","status-publish","format-standard","hentry","category-applications","category-ha-clustering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-24T19:09:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-12T18:55:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16\",\"datePublished\":\"2016-08-24T19:09:09+00:00\",\"dateModified\":\"2018-01-12T18:55:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/\"},\"wordCount\":456,\"commentCount\":0,\"articleSection\":[\"Applications\",\"HA &amp; Clustering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/\",\"name\":\"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-08-24T19:09:09+00:00\",\"dateModified\":\"2018-01-12T18:55:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/replicate-storage-across-servers-glusterfs-ubuntu-16\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech","description":"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/","og_locale":"en_US","og_type":"article","og_title":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech","og_description":"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !","og_url":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/","og_site_name":"Globo.Tech","article_published_time":"2016-08-24T19:09:09+00:00","article_modified_time":"2018-01-12T18:55:05+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16","datePublished":"2016-08-24T19:09:09+00:00","dateModified":"2018-01-12T18:55:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/"},"wordCount":456,"commentCount":0,"articleSection":["Applications","HA &amp; Clustering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/","url":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/","name":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-08-24T19:09:09+00:00","dateModified":"2018-01-12T18:55:05+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to replicate storage accross server using GlusterFS on your Ubuntu 16.04 server. Read now !","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/replicate-storage-across-servers-glusterfs-ubuntu-16\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Replicate Storage Across Servers using GlusterFS on Ubuntu 16"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2567"}],"version-history":[{"count":9,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2567\/revisions"}],"predecessor-version":[{"id":4069,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2567\/revisions\/4069"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}