{"id":3909,"date":"2017-11-28T10:29:24","date_gmt":"2017-11-28T15:29:24","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=3909"},"modified":"2017-11-28T10:29:24","modified_gmt":"2017-11-28T15:29:24","slug":"install-galera-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/","title":{"rendered":"How to Install Galera on CentOS 7"},"content":{"rendered":"<h1>How to Install Galera on CentOS 7<\/h1>\n<div class=\"row\">\n<div class=\"col-lg-10\">\n<p>Galera is a shortened name for <a rel=\"nofollow\" href=\"http:\/\/galeracluster.com\/products\/\" target=\"_blank\">Galera Cluster<\/a>, which is a multi-master database cluster that provides synchronous replication for MySQL or MariaDB. With Galera in use, the read and write requests can be directed to different nodes based on need; this allows a node to be compromised or lost without experiencing an interruption in normal operation. Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data integrity and performance in ways that previous solutions have failed to accomplish.<\/p>\n<\/div>\n<div class=\"col-lg-2\">\n<img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"200\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png\" alt=\"Install Galera\" class=\"alignright size-full wp-image-3918\" \/>\n<\/div>\n<\/div>\n<h2>Getting Started<\/h2>\n<p>To get started installing Galera on CentOS 7, you will need to have three nodes that already have Linux CentOS 7 installed, up to date, and running with root access. The nodes you choose can be on a <a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\"><b>cloud server<\/b><\/a> or a <a href=\"https:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\"><b>dedicated server<\/b><\/a>, whichever you prefer.<\/p>\n<h2>How to Install Galera on CentOS 7<\/h2>\n<p>Mentioned previously, the first thing to do is to ensure that you have root access to your node and the CentOS 7 operating system.<\/p>\n<p>First, you will need to disable SELinux on each of the three CentOS 7 nodes you have running:<br \/>\n<code class=\"gris\">Local IP :<br \/>\nnode1 : 10.0.0.7<br \/>\nnode2 : 10.0.0.8<br \/>\nnode3 : 10.0.0.9<\/code><\/p>\n<p>Once the nodes have SELinux disabled, it&#8217;s time to create the MariaDB repository to install Galera on each of the three nodes:<br \/>\n<code>nano \/etc\/yum.repos.d\/mariadb.repo<br \/>\n[mariadb]<br \/>\nname = MariaDB<br \/>\nbaseurl = http:\/\/yum.mariadb.org\/10.0\/centos7-amd64<br \/>\ngpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>\ngpgcheck=1<\/code><\/p>\n<p>After the repository has been created, it&#8217;s time to install Galera and any software requirements on each of the three nodes:<br \/>\n<code>yum install MariaDB-Galera-server MariaDB-client rsync galera socat -y<\/code><\/p>\n<p>Now you can start MySQL and secure MySQL on each node:<br \/>\n<code>systemctl start mysql<br \/>\nmysql_secure_installation<br \/>\nsystemctl stop mysql<\/code><\/p>\n<p>When MySQL is secured, you can add the Galera configuration to each node:<br \/>\n<code>nano \/etc\/my.cnf.d\/server.cnf<\/code><br \/>\n<code class=\"gris\">[mariadb-10.0]<br \/>\nbinlog_format=ROW<br \/>\ndefault-storage-engine=innodb<br \/>\ninnodb_autoinc_lock_mode=2<br \/>\ninnodb_locks_unsafe_for_binlog=1<br \/>\nquery_cache_size=0<br \/>\nquery_cache_type=0<br \/>\ndatadir=\/var\/lib\/mysql<br \/>\ninnodb_log_file_size=100M<br \/>\ninnodb_file_per_table<br \/>\ninnodb_flush_log_at_trx_commit=2<br \/>\nwsrep_provider=\/usr\/lib64\/galera\/libgalera_smm.so<br \/>\nwsrep_cluster_address=\"gcomm:\/\/10.0.0.7,10.0.0.8,10.0.0.9\"<br \/>\nwsrep_cluster_name='galera_cluster'<br \/>\nwsrep_node_address='10.0.0.7'<br \/>\nwsrep_node_name='node1'<br \/>\nwsrep_sst_method=rsync<br \/>\nwsrep_sst_auth=db_user:admin<\/code><\/p>\n<p>There are changes that need to be made to the second and third node.<\/p>\n<p>The change to node 2:<br \/>\n<code class=\"gris\">wsrep_node_address='10.0.0.8'<br \/>\nwsrep_node_name='node2'<\/code><\/p>\n<p>The change to node 3:<br \/>\n<code class=\"gris\">wsrep_node_address='10.0.0.9'<br \/>\nwsrep_node_name='node3'<\/code><\/p>\n<p>After completing the changes, start the cluster on node 1 only:<br \/>\n<code>\/etc\/init.d\/mysql start --wsrep-new-cluster<\/code><\/p>\n<p>When complete, it&#8217;s time to log into MySQL on each node to verify the cluster is functioning correctly:<br \/>\n<code>systemctl start mysql<\/code><\/p>\n<p>Now you can create a database to test the cluster on node 1:<br \/>\n<code>mysql -u root -p<br \/>\n MariaDB [(none)]> show status like 'wsrep%';<\/code><br \/>\n<code class=\"gris\">| wsrep_local_state_comment    | Synced                                    |<br \/>\n| wsrep_incoming_addresses     | 10.0.0.7:3306,10.0.0.8:3306,10.0.0.9:3306 |<br \/>\n| wsrep_cluster_size           | 3                                         |<\/code><\/p>\n<p>It&#8217;s time to log into node 2 and node 3, checking if the database created in node 1 exists:<br \/>\n<code class=\"gris\">MariaDB [(none)]> create database globotech;<br \/>\nMariaDB [(none)]> show databases;<br \/>\n+--------------------+<br \/>\n| Database           |<br \/>\n+--------------------+<br \/>\n| globotech          |<br \/>\n| information_schema |<br \/>\n| mysql              |<br \/>\n| performance_schema |<br \/>\n+--------------------+<br \/>\n4 rows in set (0.00 sec)<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>Congratulations, you&#8217;ve successfully completed the installation of Galera on your nodes running CentOS 7. Now you can move your database cluster into production. If you found this tutorial helpful, please share it with other users setting up Galera on CentOS as well. <\/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 Install Galera on CentOS 7 Galera is a shortened name for Galera Cluster, which is a multi-master database cluster that provides synchronous replication for MySQL or MariaDB. With Galera in use, the read and write requests can be directed to different nodes based on need; this allows a node to be compromised or<!-- 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-3909","post","type-post","status-publish","format-standard","hentry","category-ha-clustering","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Galera on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...\" \/>\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\/install-galera-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Galera on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-28T15:29:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.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\\\/install-galera-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to Install Galera on CentOS 7\",\"datePublished\":\"2017-11-28T15:29:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/\"},\"wordCount\":383,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/Galera-Cluster.png\",\"articleSection\":[\"HA &amp; Clustering\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/\",\"name\":\"How to Install Galera on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/Galera-Cluster.png\",\"datePublished\":\"2017-11-28T15:29:24+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/Galera-Cluster.png\",\"contentUrl\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/Galera-Cluster.png\",\"width\":200,\"height\":200,\"caption\":\"Install Galera\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-galera-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Galera on CentOS 7\"}]},{\"@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 Install Galera on CentOS 7 - Globo.Tech","description":"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...","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\/install-galera-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Galera on CentOS 7 - Globo.Tech","og_description":"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...","og_url":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2017-11-28T15:29:24+00:00","og_image":[{"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png","type":"","width":"","height":""}],"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\/install-galera-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to Install Galera on CentOS 7","datePublished":"2017-11-28T15:29:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/"},"wordCount":383,"commentCount":0,"image":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png","articleSection":["HA &amp; Clustering"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/","name":"How to Install Galera on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#primaryimage"},"image":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png","datePublished":"2017-11-28T15:29:24+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"How to Install Galera on CentOS 7: Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data...","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#primaryimage","url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png","contentUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2017\/11\/Galera-Cluster.png","width":200,"height":200,"caption":"Install Galera"},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-galera-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Install Galera on CentOS 7"}]},{"@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\/3909","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=3909"}],"version-history":[{"count":9,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/3909\/revisions"}],"predecessor-version":[{"id":3919,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/3909\/revisions\/3919"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=3909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=3909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=3909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}