{"id":44,"date":"2014-09-23T03:30:00","date_gmt":"2014-09-23T03:30:00","guid":{"rendered":"http:\/\/www.asianux.org.vn\/index.php\/2014\/09\/23\/how-to-setup-mariadb-galera-cluster-on-centos-7\/"},"modified":"2014-09-23T03:30:00","modified_gmt":"2014-09-23T03:30:00","slug":"how-to-setup-mariadb-galera-cluster-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2014\/09\/23\/how-to-setup-mariadb-galera-cluster-on-centos-7\/","title":{"rendered":"How to Setup MariaDB Galera Cluster  on CentOS 7"},"content":{"rendered":"<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">MariaDB Galera Cluster<\/strong><span>&nbsp;<\/span>10.0.12 Stable has been released and available for production use.<span>&nbsp;<\/span><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">MariaDB<\/strong><span>&nbsp;<\/span>is a relational database management system (RDBMS). Generally we use single node of database server for small application but think about application which have thousands of users keep online at a time, In that situation we need a structure which will capable to handle this load and provides high availability. So we need to add multiple database servers interconnected with each other and keep synchronized, so in case any server goes down other servers can take place of them and provide services to users.<\/div>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\"><\/div>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">This article will help you to set up MariaDB Galera Cluster&nbsp; with 3 nodes running with CentOS 7. Cluster server details are as following.<\/div>\n<ul style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #bbbbbb; font-family: 'Microsoft Sans Serif', helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 23px; list-style: circle; margin: 0.5em 0px 1.571em 1.3em; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">\n<ul style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; list-style: circle; margin: 0.5em 0px 1.571em 1.3em; padding: 0px; vertical-align: baseline;\">\n<li style=\"border: 0px; color: #555555; font-family: 'Roboto Slab', arial, sans-serif; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">Cluster DB1:<\/strong><span>&nbsp;<\/span>192.168.1.10 ( HostName:<span>&nbsp;<\/span>db1.sysadmin.com.vn<span> <\/span>)<\/li>\n<li style=\"border: 0px; color: #555555; font-family: 'Roboto Slab', arial, sans-serif; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">Cluster DB2:<\/strong><span>&nbsp;<\/span>192.168.1.20 ( HostName:<span>&nbsp;<\/span>db2.sysadmin.com.vn<span> <\/span>)<\/li>\n<li style=\"border: 0px; color: #555555; font-family: 'Roboto Slab', arial, sans-serif; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">Cluster DB3:<\/strong><span>&nbsp;<\/span>192.168.1.30 ( HostName:<span>&nbsp;<\/span>db3.sysadmin.com.vn<span> <\/span>)<\/li>\n<\/ul>\n<\/ul>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">Note:<\/strong><span>&nbsp;<\/span><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">Step 1\/2\/3<\/strong><span>&nbsp;<\/span>has to be done on all cluster nodes and remaining steps are node specific.<\/div>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 1: Add MariaDB Repositories<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Create a mariadb repository<span>&nbsp;<\/span><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">\/etc\/yum.repos.d\/mariadb.repo<\/strong><span>&nbsp;<\/span>using following content in your system. Below repository will work on CentOS 6.x systems, For othe<br \/>\nr system use<span>&nbsp;<\/span><a href=\"https:\/\/downloads.mariadb.org\/mariadb\/repositories\/\" style=\"-webkit-tap-highlight-color: rgb(255, 94, 153); -webkit-transition: background-color, color 0.2s linear; border: 0px; color: #ff6200; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; text-decoration: none; transition: background-color, color 0.2s linear; vertical-align: baseline;\" target=\"_blank\" rel=\"noopener\">repository generation tool<\/a><span>&nbsp;<\/span>and add to your system.<\/div>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">For CentOS 6 \u2013 64bit<\/strong><\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[mariadb]<br \/>name = MariaDB<br \/>baseurl = http:\/\/yum.mariadb.org\/10.0\/centos6-amd64<br \/>gpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>gpgcheck=1<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\"><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">For CentOS 6 \u2013 32bit<\/strong><\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[mariadb]<br \/>name = MariaDB<br \/>baseurl = http:\/\/yum.mariadb.org\/10.0\/centos6-x86<br \/>gpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>gpgcheck=1<br \/><\/pre>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 2: Install MariaDB and Galera<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Before installing MariaDB Galera cluster packages, remove any existing MySQL or MariaDB packages installed on system. After that use following command to install on all nodes.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\"># yum install MariaDB-Galera-server MariaDB-client galera<br \/><\/pre>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 3: Initial MariaDB Configuration<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">After successfully installing packages in above steps do the some initial MariaDB configurations. Use following command and follow the instructions on all nodes of cluster. If will prompt to set root account password also.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\"># service mysql start<br \/># mysql_secure_installation<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-vari\nant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">After that create a user in MariaDB on all nodes, which can access database from your network in cluster.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\"># mysql -u root -p<br \/><br \/>MariaDB [(none)]&gt; GRANT ALL PRIVILEGES ON *.* TO 'cluster'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;<br \/>MariaDB [(none)]&gt; FLUSH PRIVILEGES;<br \/>MariaDB [(none)]&gt; exit<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">and stop MariaDB service before starting cluster configuration<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\"># service mysql stop<br \/><\/pre>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 4: Setup MariaDB Galera Cluster on DB1<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Lets start setup MariaDB Galera cluster from DB1 server. Edit MariaDB server configuration file and add following values under<span>&nbsp;<\/span><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">[mariadb]<\/strong><span>&nbsp;<\/span>section.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db1 ~]# vim \/etc\/my.cnf.d\/server.cnf<br \/><\/pre>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">query_cache_size=0<br \/>binlog_format=ROW<br \/>default_storage_engine=innodb<br \/>innodb_autoinc_lock_mode=2<br \/>wsrep_provider=\/usr\/lib\/galera\/libgalera_smm.so<br \/>wsrep_cluster_address=\"gcomm:\/\/192.168.1.10,192.168.1.20,192.168.1.30\"<br \/>wsrep_cluster_name='cluster1'<br \/>wsrep_node_address='192.168.1.10'<br \/>wsrep_node_name='db1'<br \/>wsrep_sst_method=rsync<br \/>wsrep_sst_auth=cluster:password<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Start cluster using following command.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db1 ~]# \/etc\/init.d\/mysql bootstrap<br \/>Bootstrapping the clusterStarting MySQL.... SUCCESS!<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">If you get any problem during startup check MariaDB error log file \/var\/lib\/mysql\/&lt;hostname&gt;.err<\/div>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0p\nx 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 5: Add DB2 in MariaDB Cluster<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">After successfully starting cluster on DB1. Start configuration on DB2. Edit MariaDB server configuration file and add following values under<span>&nbsp;<\/span><strong style=\"border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: 700; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;\">[mariadb]<\/strong><span>&nbsp;<\/span>section. All the settings are similar to DB1 except wsrep_node_address, wsrep_cluster_address and wsrep_node_name.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db2 ~]# vim \/etc\/my.cnf.d\/server.cnf<br \/><\/pre>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">query_cache_size=0<br \/>binlog_format=ROW<br \/>default_storage_engine=innodb<br \/>innodb_autoinc_lock_mode=2<br \/>wsrep_provider=\/usr\/lib\/galera\/libgalera_smm.so<br \/>wsrep_cluster_address=\"gcomm:\/\/192.168.1.10,192.168.1.20,192.168.1.30\"<br \/>wsrep_cluster_name='cluster1'<br \/>wsrep_node_address='192.168.1.20'<br \/>wsrep_node_name='db2'<br \/>wsrep_sst_method=rsync<br \/>wsrep_sst_auth=cluster:password<br \/><br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Start cluster using following command.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db2 ~]# \/etc\/init.d\/mysql start<br \/>Starting MySQL..... SUCCESS!<br \/><\/pre>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 6: Add DB3 in MariaDB Cluster<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">This server is optional, If you want only two server in cluster, you can ignore this step, but you need to remove third server ip from DB1\/DB2 configuration files. To add this server make changes same as DB2.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db3 ~]# vim \/etc\/my.cnf.d\/server.cnf<br \/><\/pre>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll rgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">query_cache_size=0<br \/>binlog_format=ROW<br \/>default_storage_engine=innodb<br \/>innodb_autoinc_lock_mode=2<br \/>wsrep_provider=\/usr\/lib\/galera\/libgalera_smm.so<br \/>wsrep_cluster_address=\"gcomm:\/\/192.168.1.10,192.168.1.20,192.168.1.30\"<br \/>wsrep_cluster_name='cluster1'<br \/>wsrep_node_address='192.168.1.30'<br \/>wsrep_node_name='db2'<br \/>wsrep_sst_method=rsync<br \/>wsrep_sst_auth=cluster:password<br \/><\/pre>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Start cluster using following command.<\/div>\n<pre style=\"-webkit-text-stroke-width: 0px; background: none 0px 0px repeat scroll\nrgb(85, 85, 85); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); color: white; font-family: monospace, consolas, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 5px 0px 20px; orphans: auto; overflow: auto; padding: 8px 10px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: auto; word-spacing: 0px;\">[root@db3 ~]# \/etc\/init.d\/mysql start<br \/>Starting MySQL..... SUCCESS!<br \/><\/pre>\n<h2 style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: rgb(255, 98, 0) !important; font-family: 'Roboto Slab', arial, sans-serif; font-size: 20px; font-style: normal; font-variant: normal; font-weight: bolder; letter-spacing: normal; line-height: 34px; margin: 45px 0px 12px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">Step 7: Test MariaDB Galera Cluster Setup<\/h2>\n<div style=\"-webkit-margin-after: 1em; -webkit-margin-before: 1em; -webkit-margin-end: 0px; -webkit-margin-start: 0px; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #555555; display: block; font-family: 'Roboto Slab', arial, sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 12.5px; orphans: auto; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: auto; word-spacing: 0px;\">At this stage your cluster setup has been completed and running properly. Now you can test the cluster setup by creating database and tables at any server in cluster, it will replicate immediately to all servers in cluster.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MariaDB Galera Cluster&nbsp;10.0.12 Stable has been released and available for production use.&nbsp;MariaDB&nbsp;is a relational database management system (RDBMS). Generally we use single node of database server for small application but think about application which have&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}