{"id":1828,"date":"2016-04-20T20:11:57","date_gmt":"2016-04-21T00:11:57","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=1828"},"modified":"2017-12-12T16:09:46","modified_gmt":"2017-12-12T21:09:46","slug":"how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/","title":{"rendered":"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04"},"content":{"rendered":"<h1>How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04<\/h1>\n<p>Galera let&#8217;s you scale your database setup both vertically and horizontally. If you feel that your reads are not fast enough or you would like to rearrange your database server-web server assignations, scaling horizontally by adding database servers is recommended. Just make sure to follow the right steps.<\/p>\n<h2>GETTING STARTED<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 An existing Galera Cluster running on Ubuntu 14.04<br \/>\n\u2022 2\u00a0new Node (<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 Servers<\/a>) with Ubuntu 14.04 LTS installed<\/p>\n<p><code class=\"rouge\"><span style=\"text-decoration: underline;\"><strong>Warning!<\/strong><\/span> To keep an healthy Quorum, it's very important to always keep an odd numbers of Galera node. In this tutorial, we will be adding 2 new nodes to an existing Galera Cluster(3nodes). If you only want to only add the capacity of 1 node to the Galera cluster, you can add what we can an Arbitrator to your cluster to act as your 5th member of your quorum. You can learn more on how to setup a Galera Arbitrator node here. As usual, we recommend that you first have a backup of your data before making any changes in production.<\/code><\/p>\n<h2>Installing Galera on the new nodes<\/h2>\n<p>On your new nodes, the first step will be to install the Galera repository and packages. We start that process by adding the python software properties package.<br \/>\n<code>apt-get install software-properties-common<br \/>\napt-key adv --keyserver keyserver.ubuntu.com --recv BC19DDBA<\/code><\/p>\n<p>Then you need to create a repository file and add it in the source list, \/etc\/apt\/sources.list.d\/galera.list, so that apt can query that repository.<\/p>\n<p><code>deb http:\/\/releases.galeracluster.com\/ubuntu trusty\u00a0 main<\/code><\/p>\n<p>Now that we have a new repository setup, we update the apt cache and install the packages.<\/p>\n<p><code>apt-get update<br \/>\napt-get install galera-3 galera-arbitrator-3 mysql-wsrep-5.6<\/code><\/p>\n<p><code class=\"gris\">Make sure you have done those operation on both new nodes<\/code><\/p>\n<p>You will want to verify connectivity with your 3 original nodes and the other new node, so start by pinging them.<\/p>\n<p><code>root@node4:~#ping 192.168.0.1<br \/>\nroot@node4:~#ping 192.168.0.2<br \/>\nroot@node4:~#ping 192.168.0.3<br \/>\nroot@node4:~#ping 192.168.0.5<br \/>\nroot@node5:~#ping 192.168.0.1<br \/>\nroot@node5:~#ping 192.168.0.2<br \/>\nroot@node5:~#ping 192.168.0.3<br \/>\nroot@node5:~#ping 192.168.0.4<\/code><\/p>\n<p>Then, try to connect to the MySQL server on the other nodes. By example from Node4 to MySQL on Node1(192.168.0.1)<\/p>\n<p><code>mysql\u00a0 -H 192.168.0.1 \u2013u root -p<\/code><\/p>\n<p>If you get a request to input your password, this means the mysql server on the other side is listening. You can now proceed with configuring MySQL properly.<\/p>\n<h2>Configuring the new Galera Node<\/h2>\n<p>From one of your original nodes(Node1 by example), copy the configuration to the new nodes. In this example, we are copying the file from Node1 to Node4:<\/p>\n<p><code>scp \/etc\/mysql\/my.cnf root@192.168.0.4:\/etc\/mysql\/<\/code><\/p>\n<p>You may also want to copy the \/etc\/mysql\/debian.cnf file from one of the original nodes. In this example, we are copying the file from Node1 to Node4:<\/p>\n<p><code>scp \/etc\/mysql\/debian.cnf root@192.168.0.4:\/etc\/mysql\/<\/code><\/p>\n<p>On the new nodes, create the necessary users. This operation will be needed on Node4 and Node 5:<\/p>\n<p><code>mysql \u2013u root \u2013p<br \/>\nCREATE USER \u2018wsrep\u2019@\u2019%\u2019 IDENTIFIED BY \u2018password\u2019;<br \/>\nCREATE USER \u2018root\u2019@\u2019%\u2019 IDENTIFIED BY \u2018password\u2019;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;<\/code><\/p>\n<p>Finally, make sure to add the new server to the wsrep_cluster_address line in the mysql configuration file.<\/p>\n<p><code>wsrep_cluster_address=\"gcomm:\/\/192.168.0.1,192.168.0.2,192.168.0.3,192.168.0.4,192.168.0.5\"<\/code><\/p>\n<p>One last thing before you start up the new components:<\/p>\n<p><code class=\"rouge\"><span style=\"text-decoration: underline;\"><strong>Warning!<\/strong><\/span> if you\u2019re using rsync or mysqldump for SST transfer, bringing up the new nodes will lock the databases on the donor nodes. This could bring down heavily used setups. It would be strongly recommended to add those nodes when the setup is less solicited. Additionally, you may want to set the load balancer to only redirect requests on 2 nodes instead of 3. You would now be able to set the third node as a donor, which means it would be the only node with its DB getting locked and providing the new nodes with the data.<\/code><\/p>\n<p>To set a SST donor, add the following line in the mysql configuration on the two new nodes:<\/p>\n<p><code>wsrep_sst_donor= donornodename<\/code><\/p>\n<p>You can then start the new nodes and they should start replicating the data from the donors.<\/p>\n<p><code>service mysql restart<\/code><\/p>\n<h2>Testing It<\/h2>\n<p>Just like when setting up your original setup, you can test the replication by adding databases. However, if your cluster is already getting used, you can just watch as new data gets replicated to it by running a test query on the new nodes. Something really simple like listing the databases should work.<\/p>\n<p><code>mysql -u root -p<br \/>\nshow databases;<\/code><\/p>\n<p>Alternatively, if you want to make sure your new nodes are in the cluster, use the following :<\/p>\n<p><code>show status like '%wsrep%';<\/code><\/p>\n<p>The line &#8220;wsrep_cluster_size&#8221; in the output will tell you how many nodes are in the cluster. If that number is equal to how many servers you have setup, then all is well. You have now managed to scale out your cluster.<\/p>\n<h2>Conclusion<\/h2>\n<p>Your Galera cluster now runs on 5 nodes and is ready for more action. 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>Galera let&#8217;s you scale your database setup both vertically and horizontally. If you feel that your reads are not fast enough or you would like to rearrange your database server-web server assignations, scaling horizontally by adding database servers is recommended. Just make sure to follow the right steps.<!-- 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":[61],"tags":[],"class_list":["post-1828","post","type-post","status-publish","format-standard","hentry","category-database","operating_system-ubuntu-14-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.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\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.04 server. Read now !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-21T00:11:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-12T21:09:46+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=\"4 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\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/\",\"name\":\"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"datePublished\":\"2016-04-21T00:11:57+00:00\",\"dateModified\":\"2017-12-12T21:09:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.04 server. Read now !\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04\"}]},{\"@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 Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech","description":"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.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\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/","og_locale":"en_US","og_type":"article","og_title":"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech","og_description":"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.04 server. Read now !","og_url":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/","og_site_name":"Globo.Tech","article_published_time":"2016-04-21T00:11:57+00:00","article_modified_time":"2017-12-12T21:09:46+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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/","url":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/","name":"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-04-21T00:11:57+00:00","dateModified":"2017-12-12T21:09:46+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to add a new node to a Galera Replication Cluster on your Ubuntu 14.04 server. Read now !","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/how-to-add-a-new-node-to-a-galera-replication-cluster-on-ubuntu-14-04-lts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Add a new Node to a Galera Replication Cluster on Ubuntu 14.04"}]},{"@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\/1828","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=1828"}],"version-history":[{"count":9,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/1828\/revisions"}],"predecessor-version":[{"id":4023,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/1828\/revisions\/4023"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=1828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=1828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=1828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}