{"id":80,"date":"2017-12-20T20:07:18","date_gmt":"2017-12-20T20:07:18","guid":{"rendered":"http:\/\/www.linuxauthority.com\/wordpress\/?p=80"},"modified":"2018-02-01T01:08:30","modified_gmt":"2018-02-01T01:08:30","slug":"maria-dbmysql-two-node-installation-with-galera-data-replication","status":"publish","type":"post","link":"https:\/\/www.linuxauthority.com\/wordpress\/?p=80","title":{"rendered":"Maria-db(mysql) two node installation with galera data replication"},"content":{"rendered":"\n<!-- ALL ADSENSE ADS DISABLED -->\n<p>This is the first step toward unsupported installation of the NDC, New Data Cloud. To get the commercial version with full support, <a href=\"http:\/\/newdatacloud.com\" target=\"_blank\">click here<\/a>.<\/p>\n<p>This document takes you through the installation and creation of a two node database installation. This install was done in google compute engine but with the right band width will work between data centers. It is an Enterprise class solution that has absolutely no license fees whatsoever. This document is provided without support or warranty.<\/p>\n<p>The base configuration:<\/p>\n<p>2 nodes 1 VCPU 3.7 GB running CentOS 7. This does not use the Maria-db that ships with CentOS 7, which is the free version of Red Hat Enterprise Linux.<\/p>\n<p>instance-4 is primary node<\/p>\n<p>instance-5 is failover node (replication target)<a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos.png\" rel=\"attachment wp-att-88\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/downloads.mariadb.org\/mariadb\/repositories\/#mirror=mephi&amp;distro=CentOS&amp;distro_release=centos7-amd64--centos7&amp;version=10.1\">Install Mariadb repos.<\/a>\u00a0Cut and paste the repo text from the mariadb site.<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos.png\" rel=\"attachment wp-att-88\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-88\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos.png\" alt=\"install repos\" width=\"901\" height=\"645\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos.png 901w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos-300x215.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/install-repos-768x550.png 768w\" sizes=\"(max-width: 901px) 100vw, 901px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>This procedure is for version 10.1 (stable). Execute on both nodes.<\/p>\n<p>cd \/etc\/my.cnf.d<\/p>\n<p>modify server.cnf<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/server.cnf_.active.png\" rel=\"attachment wp-att-94\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-94\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/server.cnf_.active.png\" alt=\"server.cnf.active\" width=\"700\" height=\"929\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/server.cnf_.active.png 700w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/server.cnf_.active-226x300.png 226w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>#<\/p>\n<p># These groups are read by MariaDB server.<br \/>\n# Use it for options that only the server (but not clients) should see<br \/>\n#<br \/>\n# See the examples of server my.cnf files in \/usr\/share\/mysql\/<br \/>\n#<\/p>\n<p># this is read by the standalone daemon and embedded servers<br \/>\n[server]<\/p>\n<p># this is only for the mysqld standalone daemon<br \/>\n[mysqld]<br \/>\nlog_error=\/var\/log\/mariadb.log<\/p>\n<p>#<br \/>\n# * Galera-related settings<br \/>\n#<br \/>\n[galera]<br \/>\n# Mandatory settings<br \/>\n<span style=\"color: #000080;\">binlog_format=ROW<\/span><br \/>\n<span style=\"color: #000080;\"> default-storage-engine=innodb<\/span><br \/>\n<span style=\"color: #000080;\"> innodb_autoinc_lock_mode=2<\/span><br \/>\n<span style=\"color: #000080;\"> bind-address=0.0.0.0<\/span><br \/>\n<span style=\"color: #000080;\"> wsrep_on=ON<\/span><br \/>\n<span style=\"color: #000080;\"> wsrep_provider=\/usr\/lib64\/galera\/libgalera_smm.so<\/span><br \/>\n<span style=\"color: #000080;\"> wsrep_cluster_address=&#8221;gcomm:\/\/10.240.0.2,10.240.0.3&#8243;<\/span><\/p>\n<p>## Galera Cluster Configuration<br \/>\n<span style=\"color: #000080;\">wsrep_cluster_name=&#8217;cluster1&#8242;<\/span><br \/>\n## Galera Synchronization Configuration<br \/>\n<span style=\"color: #000080;\">wsrep_sst_method=rsync<\/span><br \/>\n## Galera Node Configuration<br \/>\n<span style=\"color: #000080;\">wsrep_node_address=&#8217;10.240.0.2&#8242;<\/span><br \/>\n<span style=\"color: #000080;\"> wsrep_node_name=&#8217;instance-4&#8242;<\/span><br \/>\n# this is only for embedded server<br \/>\n[embedded]<\/p>\n<p># This group is only read by MariaDB servers, not by MySQL.<br \/>\n# If you use the same .cnf file for MySQL and MariaDB,<br \/>\n# you can put MariaDB-only options here<br \/>\n[mariadb]<\/p>\n<p># This group is only read by MariaDB-10.1 servers.<br \/>\n# If you use the same .cnf file for MariaDB of different versions,<br \/>\n# use this group for options that older servers don&#8217;t understand<br \/>\n[mariadb-10.1]<\/p>\n<p>On failover node edit the same file<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/instance-5.servercnf.png\" rel=\"attachment wp-att-96\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-96\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/instance-5.servercnf.png\" alt=\"instance-5.servercnf\" width=\"589\" height=\"981\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/instance-5.servercnf.png 589w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/instance-5.servercnf-180x300.png 180w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>#<\/p>\n<p># These groups are read by MariaDB server.<br \/>\n# Use it for options that only the server (but not clients) should see<br \/>\n#<br \/>\n# See the examples of server my.cnf files in \/usr\/share\/mysql\/<br \/>\n#<\/p>\n<p># this is read by the standalone daemon and embedded servers<br \/>\n[server]<\/p>\n<p># this is only for the mysqld standalone daemon<br \/>\n[mysqld]<\/p>\n<p>#<br \/>\n# * Galera-related settings<br \/>\n#<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>[galera]<br \/>\n# Mandatory settings<br \/>\nwsrep_on=ON<br \/>\n#wsrep_provider=<br \/>\n#wsrep_cluster_address=<br \/>\n#binlog_format=row<br \/>\n#default_storage_engine=InnoDB<br \/>\n#innodb_autoinc_lock_mode=2<br \/>\n#<br \/>\n# Allow server to accept connections on all interfaces.<br \/>\n#<br \/>\n#bind-address=0.0.0.0<br \/>\n#<br \/>\n# Optional setting<br \/>\n#wsrep_slave_threads=1<br \/>\n#innodb_flush_log_at_trx_commit=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 \/>\nbind-address=0.0.0.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=&#8221;gcomm:\/\/10.240.0.2,10.240.0.3&#8243;<br \/>\nwsrep_cluster_name=&#8217;galera_cluster&#8217;<br \/>\nwsrep_node_address=&#8217;10.240.0.3&#8242;<br \/>\nwsrep_node_name=&#8217;db2&#8242;<br \/>\nwsrep_sst_method=rsync<br \/>\nwsrep_sst_auth=sst_user:SarBit@2010<br \/>\n#wsrep_on=ON<br \/>\n# this is only for embedded server<br \/>\n[embedded]<\/p>\n<p># This group is only read by MariaDB servers, not by MySQL.<br \/>\n# If you use the same .cnf file for MySQL and MariaDB,<br \/>\n# you can put MariaDB-only options here<br \/>\n[mariadb]<\/p>\n<p># This group is only read by MariaDB-10.1 servers.<br \/>\n# If you use the same .cnf file for MariaDB of different versions,<br \/>\n# use this group for options that older servers don&#8217;t understand<br \/>\n[mariadb-10.1]<\/p>\n<p>On active node:<\/p>\n<p>galera_new_cluster<\/p>\n<p>echo $?<\/p>\n<p>0<\/p>\n<p>## Zero return code indicates successful new cluster starrt<\/p>\n<p>systemctl status mariadb.service<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status.png\" rel=\"attachment wp-att-100\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-100\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status.png\" alt=\"activenode.status\" width=\"1090\" height=\"449\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status.png 1090w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status-300x124.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status-768x316.png 768w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/activenode.status-1024x422.png 1024w\" sizes=\"(max-width: 1090px) 100vw, 1090px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>On passive or replication node:<\/p>\n<p>systemctl start mariadb.service<\/p>\n<p>systemctl status mariadb.service<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status.png\" rel=\"attachment wp-att-102\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-102\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status.png\" alt=\"passive.node.status\" width=\"1092\" height=\"380\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status.png 1092w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status-300x104.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status-768x267.png 768w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/passive.node_.status-1024x356.png 1024w\" sizes=\"(max-width: 1092px) 100vw, 1092px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Check the logs:<\/p>\n<p>tail -f \/var\/log\/mariadb.log<\/p>\n<p><a href=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs.png\" rel=\"attachment wp-att-106\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-106\" src=\"http:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs.png\" alt=\"mariadblogs\" width=\"1169\" height=\"557\" srcset=\"https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs.png 1169w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs-300x143.png 300w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs-768x366.png 768w, https:\/\/www.linuxauthority.com\/wordpress\/wp-content\/uploads\/2017\/12\/mariadblogs-1024x488.png 1024w\" sizes=\"(max-width: 1169px) 100vw, 1169px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/galeracluster.com\/documentation-webpages\/monitoringthecluster.html\" target=\"_blank\">To check galleria cluster status see this page.<\/a><\/p>\n<p>You have an\u00a0 Enterprise class active-passive database cluster.<\/p>\n<p>You paid Oracle $0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first step toward unsupported installation of the NDC, New Data Cloud. To get the commercial version with full support, click here. This document takes you through the installation and creation of a two node database installation. This install was done in google compute engine but with the right band width will work [&hellip;]<\/p>\n<a role=\"link\" class=\"rtp-readmore\" title=\"Read more on Maria-db(mysql) two node installation with galera data replication\" href=\"https:\/\/www.linuxauthority.com\/wordpress\/?p=80\" rel=\"nofollow\">Read More &rarr;<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9,21,11],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-clustering-2","category-scripting-2","category-systems-administration","category-yum"],"_links":{"self":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/80"}],"collection":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80"}],"version-history":[{"count":12,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions\/118"}],"wp:attachment":[{"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxauthority.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}