{"id":2291,"date":"2016-07-26T15:16:43","date_gmt":"2016-07-26T19:16:43","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2291"},"modified":"2017-11-24T17:54:16","modified_gmt":"2017-11-24T22:54:16","slug":"setup-drbd-9-ubuntu-16","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/","title":{"rendered":"How to Setup DRBD 9 on Ubuntu 16"},"content":{"rendered":"<h1>How to Setup DRBD 9 on Ubuntu 16<\/h1>\n<p>DRBD, or Distributed Replicated Block Device, is a special kind of data storage that uses multiple servers. A &#8220;primary&#8221; server stores the data, and the other &#8220;passive&#8221; servers act as mirrors of the primary. If the primary server fails, one of the passive servers will then become the primary.<\/p>\n<p>DRBD is an excellent solution for preventing data loss for businesses of any size. Additionally, the codebase is open source under the GNU General Public License (version 2), meaning it can be tweaked for the needs of an individual company.<\/p>\n<h2>Getting started<\/h2>\n<p>Before following this guide, make sure you have prepared these prerequisites:<br \/>\n\u2022 2 Nodes (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\"><b>Cloud Server<\/b><\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\"><b>Dedicated Server<\/b><\/a>) running Ubuntu 16.<br \/>\n\u2022 All commands should be run as the root user<br \/>\n\u2022 At least one partition free on each node (Partition must have the same size)<\/p>\n<h2>Tutorial<\/h2>\n<p>Ubuntu 16 only has DRBD version 8 in the repositories. Fortunately, you can upgrade to version 9 with not much trouble.<\/p>\n<p><code>sudo apt-get update<br \/>\nsudo apt-get install -y drbd8-utils<\/code><\/p>\n<p>Once it&#8217;s installed, you will have to ensure that your server&#8217;s hostname will be resolved to the IP Address that you&#8217;ll be using for the cluster. This requires a quick edit of \/etc\/hosts. Open the file in a text editor and replace 127.0.0.1 (the loopback address) with the server&#8217;s hostname.<\/p>\n<p>In the example below, we have two hosts named alice and bob. In each \/etc\/hosts file we have input the same entries:<\/p>\n<p><code>127.0.0.1 localhost<br \/>\n192.168.56.101 bob<br \/>\n192.168.56.102 alice<\/code><\/p>\n<p>Additionally, the Network Time Protocol, or NTP, must be installed on each server for accurate time syncing.<\/p>\n<p><code>sudo apt-get install -y ntp<\/code><\/p>\n<p>Each host should have an additional unused disk on partition. On each of these disks, create a partition of the same size. This is where the data will be replicated.<\/p>\n<p><code>sudo dd if=\/dev\/zero of=\/dev\/sdb1<\/code><\/p>\n<p>Next, on each host edit the DRBD configuration file, which should be located at \/etc\/drbd.conf.<\/p>\n<p><code>global { usage-count no; }<br \/>\ncommon { protocol C; }<br \/>\nresource r0 {<br \/>\n    on bob {<br \/>\n        device \/dev\/drbd0;<br \/>\n        disk \/dev\/sdb1;<br \/>\n        address 192.168.56.101:7788;<br \/>\n        meta-disk internal;<br \/>\n    }<br \/>\n    on alice {<br \/>\n        device \/dev\/drbd0;<br \/>\n        disk \/dev\/sdb1;<br \/>\n        address 192.168.56.102:7788;<br \/>\n        meta-disk internal;<br \/>\n    }<br \/>\n}<\/code><\/p>\n<p>Load the kernel module on each system.<\/p>\n<p><code>sudo modprobe drbd<\/code><\/p>\n<p>Now all you have to do is create the mirror device:<\/p>\n<p><code>sudo drbdadm create-md r0<\/code><\/p>\n<p>Then simply bring the mirror device online with this command.<\/p>\n<p><code>sudo drbdadm up r0<\/code><\/p>\n<p>You can view the status of the mirroring like so:<\/p>\n<p><code>sudo drbd-overviewsudo cat \/etc\/drbd<\/code><\/p>\n<p>Both nodes are initially set to be secondary, or passive. Force one of the nodes to be primary:<\/p>\n<p><code>sudo drbdadm -- --overwrite-data-of-peer primary r0\/0<\/code><\/p>\n<p>Afterwards, format and mount the disk.<\/p>\n<p><code>sudo mkfs.ext4 \/dev\/drbd0<br \/>\nsudo mkdir -p \/var\/www\/html<br \/>\nsudo mount \/dev\/drbd0 \/var\/www\/html<\/code><\/p>\n<p>In order to upgrade, do the following:<\/p>\n<p><code>apt install software-properties-common<\/code><\/p>\n<p>then<\/p>\n<p><code>sudo add-apt-repository ppa:linbit\/linbit-drbd9-stack<\/code><\/p>\n<p>Finally, perform apt-get update so that Debian will recognize the updated repository. After that, you can run the apt-get upgrade to upgrade DRBD to version 9. <\/p>\n<p><code>apt-get update<br \/>\napt-get upgrade<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>DRBD provides a secure, reliable way to ensure data never goes missing upon HD or server failure. You can add as many servers as you like for extra redundancy. If this guide was helpful to you, kindly share it with others who may also be interested. <\/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 Setup DRBD 9 on Ubuntu 16 DRBD, or Distributed Replicated Block Device, is a special kind of data storage that uses multiple servers. A &#8220;primary&#8221; server stores the data, and the other &#8220;passive&#8221; servers act as mirrors of the primary. If the primary server fails, one of the passive servers will then become<!-- 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":[75],"tags":[],"class_list":["post-2291","post","type-post","status-publish","format-standard","hentry","category-ha-clustering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Setup DRBD 9 on Ubuntu 16 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now &amp; Enjoy high availability to prevent data loss!\" \/>\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\/setup-drbd-9-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 Setup DRBD 9 on Ubuntu 16 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now &amp; Enjoy high availability to prevent data loss!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-26T19:16:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-24T22:54:16+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\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/\",\"name\":\"How to Setup DRBD 9 on Ubuntu 16 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"datePublished\":\"2016-07-26T19:16:43+00:00\",\"dateModified\":\"2017-11-24T22:54:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now & Enjoy high availability to prevent data loss!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Setup DRBD 9 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 Setup DRBD 9 on Ubuntu 16 - Globo.Tech","description":"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now & Enjoy high availability to prevent data loss!","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\/setup-drbd-9-ubuntu-16\/","og_locale":"en_US","og_type":"article","og_title":"How to Setup DRBD 9 on Ubuntu 16 - Globo.Tech","og_description":"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now & Enjoy high availability to prevent data loss!","og_url":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/","og_site_name":"Globo.Tech","article_published_time":"2016-07-26T19:16:43+00:00","article_modified_time":"2017-11-24T22:54:16+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":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/","url":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/","name":"How to Setup DRBD 9 on Ubuntu 16 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-07-26T19:16:43+00:00","dateModified":"2017-11-24T22:54:16+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to set up DRDB 9 on your Ubuntu 16 server. Read now & Enjoy high availability to prevent data loss!","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/setup-drbd-9-ubuntu-16\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Setup DRBD 9 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\/2291","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=2291"}],"version-history":[{"count":4,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2291\/revisions"}],"predecessor-version":[{"id":3887,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2291\/revisions\/3887"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}