{"id":5370,"date":"2015-10-18T11:26:15","date_gmt":"2015-10-18T03:26:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=5370"},"modified":"2015-10-18T22:27:16","modified_gmt":"2015-10-18T14:27:16","slug":"multi-master-mariadb-galera-cluster","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5370","title":{"rendered":"multi-master MariaDB Galera Cluster"},"content":{"rendered":"<h1 class=\"entry-title\">CentOS 6.7 Linux compilation configure a multi-master MariaDB Galera Cluster for HA.<\/h1>\n<p><strong>Multi-master MariaDB Galera Cluster<\/strong><\/p>\n<p>Summary<br \/>\nGalera is essentially a wsrep provider (provider), relies on the wsrep API interface. Wsrep API defines a set of applications and replication callback call library to implement transaction database synchronization write set (writeset) replication, and similar applications. The purpose is to achieve the abstract, isolated copied from the application details. While the main objective of the interface is based on the certification of multi-master replication, but the same applies to asynchronous and synchronous master-slave replication.<br \/>\nPersonal feeling MariaDB Galera across the room to do a multi-master is still very convenient, than direct shots from good use MySQL. Like with other clusters, in order to avoid node split brain and destroy data, we recommend a minimum Galera Cluster add three nodes. Galera Cluster in the case of high concurrency, may occur when multiple simultaneous write transaction main conflict, this time only one transaction request will be successful, all others failed. You can write \/ update fails, the automatic retry, and then returns the result. Node status of each node is equal, there is no primary and secondary, to read any one node effect is the same. Can actually fit VIP \/ LVS or HA uses to achieve high availability. If all the machines in the cluster restart, such as room off, the first start of the server must be started with an empty address.<br \/>\nGalera Cluster is a set of synchronous multi-master MySQL replication cluster solution, easy to use, there is no single point of failure, high availability, can be very good at all times to ensure the safety and the expansion of our data when business is growing.<br \/>\nFirst, compile and install MariaDB Galera Here to talk about multi-master cluster<\/p>\n<p>cluster1.rmohan.com\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Centos6.7\u00a0\u00a0 192.168.1.60\u00a0\u00a0\u00a0 MariaDB<br \/>\ncluster2.rmohan.com\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Centos6.7\u00a0\u00a0 192.168.1.62\u00a0\u00a0\u00a0 MariaDB<br \/>\ncluster3.rmohan.com\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Centos6.7\u00a0\u00a0 192.168.1.63\u00a0\u00a0\u00a0 MariaDB<\/p>\n<p>Hereinafter, if the command is not preceded by PS1 is to represent the three nodes are required to perform the same action, if it means the implementation of the action on the specified node<\/p>\n<p>1, install ntpdate to set timing on node cluster1 cluster2 cluster3 each other synchronization and ssh<\/p>\n<p>yum install -y ntpdate<br \/>\nyum install openssh-askpass -y<br \/>\nyum -y install openssh-client<\/p>\n<p>echo &#8220;*\/5 * * * * \/usr\/sbin\/ntpdate pool.ntp.org &gt;\/dev\/null 2&gt;&amp;1&#8243; &gt;&gt; \/var\/spool\/cron\/root<\/p>\n<p>\/usr\/sbin\/ntpdate pool.ntp.org<\/p>\n<p>cat &gt;&gt;\/etc\/hosts&lt;&lt; EOF<br \/>\n192.168.1.60\u00a0 cluster1.rmohan.com\u00a0 cluster1<br \/>\n192.168.1.62\u00a0 cluster2.rmohan.com\u00a0 cluster2<br \/>\n192.168.1.63\u00a0 cluster3.rmohan.com\u00a0 cluster3<br \/>\nEOF<\/p>\n<p>Here is the production of a key ###<\/p>\n<p>ssh-keygen\u00a0 -t rsa -f ~\/.ssh\/id_rsa\u00a0 -P &#8221;<br \/>\n### The following are performed on each node, so that the public key of the machine onto the other nodes<br \/>\nawk &#8216;{if ($0!~\/'&#8221;$(hostname)&#8221;&#8216;|localhost\/)print $NF}&#8217; \/etc\/hosts |xargs -i ssh-copy-id -i ~\/.ssh\/id_rsa.pub root@{}<\/p>\n<p>2, installed base build environment<\/p>\n<p>Add EPEL Repository which is provided from Fedora project.<br \/>\nyum -y install epel-release<br \/>\n# set [priority=5]<\/p>\n<p>sed -i -e &#8220;s\/\\]$\/\\]\\npriority=5\/g&#8221; \/etc\/yum.repos.d\/epel.repo<br \/>\n# for another way, change to [enabled=0] and use it only when needed<br \/>\nsed -i -e &#8220;s\/enabled=1\/enabled=0\/g&#8221; \/etc\/yum.repos.d\/epel.repo<br \/>\n# if [enabled=0], input a command to use the repository<br \/>\nyum &#8211;enablerepo=epel install [Package]<\/p>\n<p>Add RPMforge Repository which provides many useful packages.<\/p>\n<p>yum -y install http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm<br \/>\n# set [priority=10]<br \/>\nsed -i -e &#8220;s\/\\]$\/\\]\\npriority=10\/g&#8221; \/etc\/yum.repos.d\/rpmforge.repo<br \/>\n# for another way, change to [enabled=0] and use it only when needed<br \/>\nsed -i -e &#8220;s\/enabled = 1\/enabled = 0\/g&#8221; \/etc\/yum.repos.d\/rpmforge.repo<br \/>\n# if [enabled=0], input a command to use the repository<br \/>\nyum &#8211;enablerepo=rpmforge install [Package]<\/p>\n<p>rpm -ivh http:\/\/mirrors.aliyun.com\/epel\/epel-release-latest-6.noarch.rpm<br \/>\nrpm &#8211;import http:\/\/mirrors.dwhd.org\/epel\/RPM-GPG-KEY-EPEL-6<br \/>\nrpm -ivh http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm<br \/>\nrpm &#8211;import http:\/\/mirrors.dwhd.org\/repoforge\/RPM-GPG-KEY.dag.txt<\/p>\n<p>yum clean all &amp;&amp; yum makecache<br \/>\nyum groupinstall &#8220;Development tools&#8221; &#8220;Server Platform Development&#8221; -y<br \/>\nyum install libxml2-devel lz4 lz4-devel libpcap nmap lsof socat -y<\/p>\n<p>3, Node1 compile install MariaDB Galera<\/p>\n<p>### Download Source Package cmake<br \/>\n[root@cluster1 ~]# wget http:\/\/cmake.org\/files\/v3.4\/cmake-3.4.0-rc1.tar.gz<br \/>\n### Download mariadb-galera source package<br \/>\n[root@cluster1 ~]#\u00a0 wget http:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/source\/mariadb-galera-10.0.21.tar.gz<br \/>\n### Download Source Package kytea<br \/>\n[root@cluster1 ~]# wget http:\/\/www.phontron.com\/kytea\/download\/kytea-0.4.7.tar.gz<br \/>\n### Will cmake, mariadb-galera, kytea Source Package spread to other nodes<\/p>\n<p>[root@cluster1 ~]#\u00a0 awk &#8216;{if ($0!~\/'&#8221;$(hostname)&#8221;&#8216;|localhost\/)print $NF}&#8217; \/etc\/hosts |xargs -i scp cmake-3.4.0-rc1.tar.gz mariadb-galera-10.0.21.tar.gz kytea-0.4.7.tar.gz root@{}:\/root<\/p>\n<p>3, Cluster1 compile install MariaDB Galera<\/p>\n<p>### Compile and install cmake<br \/>\n[root@cluster1 ~]# tar xf cmake-3.4.0-rc1.tar.gz<br \/>\n[Root @ cluster1 ~] # cd cmake-3.4.0-rc1<br \/>\n[root@cluster1 cmake-3.4.0-rc1]# .\/bootstrap<br \/>\n[root@cluster1 cmake-3.4.0-rc1]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..\/<br \/>\n### Compiler installation kytea<br \/>\n[root@cluster1 ~]# tar xf kytea-0.4.7.tar.gz<br \/>\n[root@cluster1 ~]# cd kytea-0.4.7\/<br \/>\n[root@cluster1 ~\/kytea-0.4.7]# .\/configure &amp;&amp; make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n### Installation Galera<br \/>\n[root@cluster1 ~]# rpm &#8211;import https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>\n[root@cluster1 ~]# rpm -ivh http:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\nhttp:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\n### Compile and install MariaDB Galera<br \/>\n[root@cluster1 ~]# mkdir -p \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster1 ~]# chown -R mysql.mysql \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster1 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz<br \/>\n[root@cluster1 ~]# cd mariadb-10.0.21\/<br \/>\n[root@cluster1 ~\/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mariadb \\<br \/>\n-DMYSQL_DATADIR=\/data\/mariadb-galera-10.0.21 \\<br \/>\n-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \\<br \/>\n-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \\<br \/>\n-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \\<br \/>\n-DMYSQL_UNIX_ADDR=\/tmp\/mysql.sock -DDEFAULT_CHARSET=utf8 \\<br \/>\n-DDEFAULT_COLLATION=utf8_general_ci \\<br \/>\n-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1<br \/>\n[root@cluster1 ~\/mariadb-10.0.21]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n[root@cluster1 ~]#<\/p>\n<p>4, cluster2 compile install MariaDB Galera<br \/>\n### Compile and install cmake<br \/>\n[root@cluster2 ~]# tar xf cmake-3.4.0-rc1.tar.gz<br \/>\n[Root @ cluster2 ~] # cd cmake-3.4.0-rc1<br \/>\n[root@cluster2 cmake-3.4.0-rc1]# .\/bootstrap<br \/>\n[root@cluster2 cmake-3.4.0-rc1]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..\/<br \/>\n### Compiler installation kytea<br \/>\n[root@cluster2 ~]# tar xf kytea-0.4.7.tar.gz<br \/>\n[root@cluster2 ~]# cd kytea-0.4.7\/<br \/>\n[root@cluster2 ~\/kytea-0.4.7]# .\/configure &amp;&amp; make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n### Installation Galera<br \/>\n[root@cluster2 ~]# rpm &#8211;import https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>\n[root@cluster2 ~]# rpm -ivh http:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\nhttp:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\n### Compile and install MariaDB Galera<br \/>\n[root@cluster2 ~]# mkdir -p \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster2 ~]# chown -R mysql.mysql \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster2 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz<br \/>\n[root@cluster2 ~]# cd mariadb-10.0.21\/<br \/>\n[root@cluster2 ~\/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mariadb \\<br \/>\n-DMYSQL_DATADIR=\/data\/mariadb-galera-10.0.21 \\<br \/>\n-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \\<br \/>\n-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \\<br \/>\n-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \\<br \/>\n-DMYSQL_UNIX_ADDR=\/tmp\/mysql.sock -DDEFAULT_CHARSET=utf8 \\<br \/>\n-DDEFAULT_COLLATION=utf8_general_ci \\<br \/>\n-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1<br \/>\n[root@cluster2 ~\/mariadb-10.0.21]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n[root@cluster2 ~]#<\/p>\n<p>5, Cluster3 compile install MariaDB Galera<\/p>\n<p>### Compile and install cmake<br \/>\n[root@cluster3 ~]# tar xf cmake-3.4.0-rc1.tar.gz<br \/>\n[Root @ cluster3 ~] # cd cmake-3.4.0-rc1<br \/>\n[root@cluster3 cmake-3.4.0-rc1]# .\/bootstrap<br \/>\n[root@cluster3 cmake-3.4.0-rc1]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..\/<br \/>\n### Compiler installation kytea<br \/>\n[root@cluster3 ~]# tar xf kytea-0.4.7.tar.gz<br \/>\n[root@cluster3 ~]# cd kytea-0.4.7\/<br \/>\n[root@cluster3 ~\/kytea-0.4.7]# .\/configure &amp;&amp; make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n### Installation Galera<br \/>\n[root@cluster3 ~]# rpm &#8211;import https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB<br \/>\n[root@cluster3 ~]# rpm -ivh http:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\nhttp:\/\/mirrors.dwhd.org\/SQL\/MariaDB\/mariadb-galera-10.0.21\/galera-25.3.9\/rpm\/galera-25.3.9-1.rhel6.el6.x86_64.rpm<br \/>\n### Compile and install MariaDB Galera<br \/>\n[root@cluster3 ~]# mkdir -p \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster3 ~]# chown -R mysql.mysql \/data\/mariadb-galera-10.0.21<br \/>\n[root@cluster3 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz<br \/>\n[root@cluster3 ~]# cd mariadb-10.0.21\/<br \/>\n[root@cluster3 ~\/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mariadb \\<br \/>\n-DMYSQL_DATADIR=\/data\/mariadb-galera-10.0.21 \\<br \/>\n-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \\<br \/>\n-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \\<br \/>\n-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \\<br \/>\n-DMYSQL_UNIX_ADDR=\/tmp\/mysql.sock -DDEFAULT_CHARSET=utf8 \\<br \/>\n-DDEFAULT_COLLATION=utf8_general_ci \\<br \/>\n-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1<br \/>\n[root@cluster3 ~\/mariadb-10.0.21]# make -j $(awk &#8216;\/processor\/{i++}END{print i}&#8217; \/proc\/cpuinfo) &amp;&amp; make install &amp;&amp; cd ..<br \/>\n[root@cluster3 ~]#<\/p>\n<p>6, configure all nodes startup scripts, environment variables on<\/p>\n<p>cd \/usr\/local\/mariadb\/<br \/>\ncp support-files\/mysql.server \/etc\/rc.d\/init.d\/mysqld<br \/>\nchmod +x \/etc\/rc.d\/init.d\/mysqld<br \/>\ncp \/usr\/local\/mariadb\/support-files\/my-large.cnf \/etc\/my.cnf<br \/>\nsed -i &#8216;\/query_cache_size\/a datadir = \/data\/mariadb-galera-10.0.21&#8217; \/etc\/my.cnf<br \/>\necho &#8220;export PATH=\/usr\/local\/mariadb\/bin:\\$PATH&#8221; &gt; \/etc\/profile.d\/mariadb_galera.sh<br \/>\nsource \/etc\/profile.d\/mariadb_galera.sh<br \/>\nsed -i &#8220;$(awk &#8216;$1==&#8221;MANPATH&#8221;{i=NR}END{print i}&#8217; \/etc\/man.config)a \\MANPATH\\tMANPATH \/usr\/local\/mariadb\/man&#8221; \/etc\/man.config<\/p>\n<p>7, Configuration node Cluster1<br \/>\n[root@cluster1 profile.d]# cd \/usr\/local\/mariadb<br \/>\n[root@cluster1 mariadb]# \/usr\/local\/mariadb\/scripts\/mysql_install_db &#8211;user=mysql &#8211;datadir=\/data\/mariadb-galera-10.0.21\/<br \/>\n[root@cluster1 mariadb]# cd &amp;&amp; service mysqld start<br \/>\nStarting MySQL.. SUCCESS!<br \/>\n[root@cluster1 ~]# ss -tnl | grep :3306<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::3306\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*<br \/>\n[root@cluster1\u00a0 ~]# mysql -uroot -p &lt;&lt;&lt; &#8220;USE mysql;<br \/>\nupdate user set password=PASSWORD(&#8216;test123&#8242;) WHERE USER=&#8217;root&#8217;;<br \/>\nDELETE FROM user WHERE User=&#8221;;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO &#8216;cluster&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;test123&#8217; WITH GRANT OPTION;<br \/>\nFLUSH PRIVILEGES;<br \/>\nSELECT USER,PASSWORD,HOST FROM user;&#8221;<br \/>\nEnter password: #### Note that the password is blank, just press Enter enough<br \/>\nUSER\u00a0\u00a0\u00a0 PASSWORD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 HOST<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localhost<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cluster1.rmohan.com<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127.0.0.1<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ::1<br \/>\ncluster *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 %<br \/>\n[root@cluster1 ~]#<\/p>\n<p>[root@cluster1~]# service mysqld stop<br \/>\nShutting down MySQL&#8230; SUCCESS!<br \/>\n[root@cluster1~]# chkconfig mysqld on<br \/>\n[root@cluster1 ~]# sed -i &#8216;\/binlog_format\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster1 ~]# sed -i &#8216;\/log_bin\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster1 ~]# sed -i &#8216;\/^datadir = \/a \\\\n\\nquery_cache_size = 0\\nlog_bin = mysql-bin\\nbinlog_format = ROW\\nexpire_logs_days = 30\\<br \/>\ndefault_storage_engine = InnoDB\\ninnodb_autoinc_lock_mode = 2\\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so\\<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/&#8221;\\nwsrep_cluster_name = LegionMariadbGaleraCluster1\\nwsrep_node_address = node1\\<br \/>\nwsrep_sst_method = rsync\\nwsrep_sst_auth = cluster:test123&#8217; \/etc\/my.cnf<br \/>\n[root@cluster1 ~]# service\u00a0 mysqld start<br \/>\nStarting MySQL.. SUCCESS!<br \/>\n[root@cluster1 ~]# ss -tnl | grep -E &#8216;:(3306|4567)&#8217;<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::3306\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:4567\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:*<\/p>\n<p>vi \/etc\/my.cnf<\/p>\n<p>[client]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\n[mysqld]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\nskip-external-locking<br \/>\nkey_buffer_size = 256M<br \/>\nmax_allowed_packet = 1M<br \/>\ntable_open_cache = 256<br \/>\nsort_buffer_size = 1M<br \/>\nread_buffer_size = 1M<br \/>\nread_rnd_buffer_size = 4M<br \/>\nmyisam_sort_buffer_size = 64M<br \/>\nthread_cache_size = 8<br \/>\nquery_cache_size= 16M<br \/>\ndatadir = \/data\/mariadb-galera-10.0.21\/<br \/>\nquery_cache_size = 0<br \/>\nlog_bin = mysql-bin<br \/>\nbinlog_format = ROW<br \/>\nexpire_logs_days = 30<br \/>\ndefault_storage_engine = InnoDB<br \/>\ninnodb_autoinc_lock_mode = 2<br \/>\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluster3&#8221;<br \/>\nwsrep_cluster_name = LegionMariadbGaleraCluster1<br \/>\nwsrep_node_address = 192.168.1.60<br \/>\nwsrep_sst_method = rsync<br \/>\nwsrep_sst_auth = cluster1:test123<br \/>\nquery_cache_size = 0<br \/>\nlog_bin = mysql-bin<br \/>\nbinlog_format = ROW<br \/>\nexpire_logs_days = 30<br \/>\ndefault_storage_engine = InnoDB<br \/>\ninnodb_autoinc_lock_mode = 2<br \/>\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluster3&#8221;<br \/>\nwsrep_cluster_name = LegionMariadbGaleraCluster1<br \/>\nwsrep_node_address=&#8217;192.168.1.60&#8242;<br \/>\nwsrep_node_name=&#8217;cluster1&#8242;<br \/>\nwsrep_sst_method=rsync<br \/>\nwsrep_sst_auth= cluster:lookback<br \/>\nthread_concurrency = 8<br \/>\nlog-bin=mysql-bin<br \/>\nserver-id\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 1<br \/>\ninnodb_log_file_size = 64M<br \/>\ninnodb_log_buffer_size = 8M<br \/>\ninnodb_flush_log_at_trx_commit = 1<br \/>\ninnodb_lock_wait_timeout = 50<br \/>\n[mysqldump]<br \/>\nquick<br \/>\nmax_allowed_packet = 16M<br \/>\n[mysql]<br \/>\nno-auto-rehash<br \/>\n[myisamchk]<br \/>\nkey_buffer_size = 128M<br \/>\nsort_buffer_size = 128M<br \/>\nread_buffer = 2M<br \/>\nwrite_buffer = 2M<br \/>\n[mysqlhotcopy]<br \/>\ninteractive-timeout<\/p>\n<p>### When I tested the rules, see the highlighted lines<br \/>\n[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state &#8211;state NEW -m tcp &#8211;dport 3306 -j ACCEPT<br \/>\n[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state &#8211;state NEW -m tcp &#8211;dport 4444 -j ACCEPT<br \/>\n[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state &#8211;state NEW -m tcp &#8211;dport 4567 -j ACCEPT<br \/>\n[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p udp -m udp &#8211;dport 4567 -j ACCEPT<br \/>\n[root@cluster1 ~]# service iptables save<br \/>\n[root@cluster1 ~]#iptables -t filter -L INPUT -n &#8211;line-numbers<\/p>\n<p>8, the configuration node Node2<br \/>\n[root@cluster2 \/usr\/local\/mariadb]# \/usr\/local\/mariadb\/scripts\/mysql_install_db &#8211;user=mysql &#8211;datadir=\/data\/mariadb-galera-10.0.21\/<br \/>\n[root@cluster2 \/usr\/local\/mariadb]# cd &amp;&amp; service mysqld start<br \/>\nStarting MySQL.. SUCCESS!<br \/>\n[root@cluster2 ~]# mysql -uroot -p &lt;&lt;&lt; &#8220;USE mysql;<br \/>\nupdate user set password=PASSWORD(&#8216;test123&#8242;) WHERE USER=&#8217;root&#8217;;<br \/>\nDELETE FROM user WHERE User=&#8221;;<br \/>\nGRANT ALL PRIVILEGES ON *.* TO &#8216;cluster&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;test123&#8217; WITH GRANT OPTION;<br \/>\nFLUSH PRIVILEGES;<br \/>\nSELECT USER,PASSWORD,HOST FROM user;&#8221;<br \/>\n[root@cluster2 ~]# service mysqld stop<br \/>\nShutting down MySQL.. SUCCESS!<br \/>\n[root@cluster2 ~]# chkconfig mysqld on<br \/>\n[root@cluster2 ~]# sed -i &#8216;\/binlog_format\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster2 ~]# sed -i &#8216;\/log.bin\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster2 ~]# sed -ri &#8216;s\/^(server-id).*\/\\1 = 2\/&#8217; \/etc\/my.cnf<br \/>\n[root@cluster2 ~]# sed -i &#8216;\/^datadir = \/a \\\\n\\nquery_cache_size = 0\\nlog_bin = mysql-bin\\nbinlog_format = ROW\\nexpire_logs_days = 30\\<br \/>\ndefault_storage_engine = InnoDB\\ninnodb_autoinc_lock_mode = 2\\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so\\<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluser3&#8243;\\nwsrep_cluster_name = LegionMariadbGaleraCluster1\\n\\<br \/>\nwsrep_node_address = node2\\nwsrep_sst_method = rsync\\nwsrep_sst_auth = cluster:test123&#8217; \/etc\/my.cnf<br \/>\n[root@cluster2 ~]# service mysqld start<br \/>\nStarting MySQL&#8230; SUCCESS!<br \/>\n[root@cluster2 ~]# ss -tnl | grep -E &#8216;:(3306|4567)&#8217;<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::3306\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:4567\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:*<br \/>\n[root@cluster2 ~]#<br \/>\n[root@cluster2 ~]# grep -v &#8216;^$\\|^\\s*\\#&#8217; \/etc\/my.cnf<br \/>\n[client]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\n[mysqld]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\nskip-external-locking<br \/>\nkey_buffer_size = 256M<br \/>\nmax_allowed_packet = 1M<br \/>\ntable_open_cache = 256<br \/>\nsort_buffer_size = 1M<br \/>\nread_buffer_size = 1M<br \/>\nread_rnd_buffer_size = 4M<br \/>\nmyisam_sort_buffer_size = 64M<br \/>\nthread_cache_size = 8<br \/>\nquery_cache_size= 16M<br \/>\ndatadir = \/data\/mariadb-galera-10.0.21<br \/>\nquery_cache_size = 0<br \/>\nlog_bin = mysql-bin<br \/>\nbinlog_format = ROW<br \/>\nexpire_logs_days = 30<br \/>\ndefault_storage_engine = InnoDB<br \/>\ninnodb_autoinc_lock_mode = 2<br \/>\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluster3&#8221;<br \/>\nwsrep_cluster_name = LegionMariadbGaleraCluster1<br \/>\nwsrep_node_address = cluster2<br \/>\nwsrep_sst_method = rsync<br \/>\nwsrep_sst_auth = cluster2:test123<br \/>\nthread_concurrency = 8<br \/>\nserver-id = 2<br \/>\n[mysqldump]<br \/>\nquick<br \/>\nmax_allowed_packet = 16M<br \/>\n[mysql]<br \/>\nno-auto-rehash<br \/>\n[myisamchk]<br \/>\nkey_buffer_size = 128M<br \/>\nsort_buffer_size = 128M<br \/>\nread_buffer = 2M<br \/>\nwrite_buffer = 2M<br \/>\n[mysqlhotcopy]<br \/>\ninteractive-timeout<\/p>\n<p>9, the configuration node Node3<\/p>\n<p>[root@cluster3 \/usr\/local\/mariadb]# \/usr\/local\/mariadb\/scripts\/mysql_install_db &#8211;user=mysql &#8211;datadir=\/data\/mariadb-galera-10.0.21\/<br \/>\n[root@cluster3 \/usr\/local\/mariadb]# cd &amp;&amp; service mysqld start<br \/>\nStarting MySQL.. SUCCESS!<br \/>\n[root@cluster3 ~]# mysql -uroot -p &lt;&lt;&lt; &#8220;USE mysql; &gt; update user set password=PASSWORD(&#8216;test123&#8242;) WHERE USER=&#8217;root&#8217;;<br \/>\n&gt; DELETE FROM user WHERE User=&#8221;;<br \/>\n&gt; GRANT ALL PRIVILEGES ON *.* TO &#8216;cluster&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;test123&#8217; WITH GRANT OPTION;<br \/>\n&gt; FLUSH PRIVILEGES;<br \/>\n&gt; SELECT USER,PASSWORD,HOST FROM user;&#8221;<br \/>\nEnter password:<br \/>\nUSER\u00a0\u00a0\u00a0 PASSWORD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 HOST<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localhost<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cluster3.ovh.net<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127.0.0.1<br \/>\nroot\u00a0\u00a0\u00a0 *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ::1<br \/>\ncluster *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 %<br \/>\n[root@cluster3 ~]# service mysqld stop<br \/>\nShutting down MySQL&#8230; SUCCESS!<br \/>\n[root@cluster3 ~]# chkconfig mysqld on<br \/>\n[root@cluster3 ~]# sed -i &#8216;\/binlog_format\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster3 ~]# sed -i &#8216;\/log.bin\/d&#8217; \/etc\/my.cnf<br \/>\n[root@cluster3 ~]# sed -ri &#8216;s\/^(server-id).*\/\\1 = 3\/&#8217; \/etc\/my.cnf<br \/>\n[root@cluster3 ~]# sed -i &#8216;\/^datadir = \/a \\\\n\\nquery_cache_size = 0\\nlog_bin = mysql-bin\\nbinlog_format = ROW\\nexpire_logs_days = 30\\<br \/>\n&gt; default_storage_engine = InnoDB\\ninnodb_autoinc_lock_mode = 2\\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so\\<br \/>\n&gt; wsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluster3&#8243;\\nwsrep_cluster_name = LegionMariadbGaleraCluster1\\n\\<br \/>\n&gt; wsrep_node_address = node3\\nwsrep_sst_method = rsync\\nwsrep_sst_auth = cluster:test123&#8217; \/etc\/my.cnf<br \/>\n[root@cluster3 ~]# service mysqld start<br \/>\nStarting MySQL..SST in progress, setting sleep higher.. SUCCESS!<\/p>\n<p>[root@cluster3 ~]# ss -tnl | grep -E &#8216;:(3306|4567)&#8217;<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::3306\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*<br \/>\nLISTEN\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:4567\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *:*<br \/>\n[root@cluster3 ~]#<br \/>\n[root@cluster3 mariadb-galera-10.0.21]# grep -v &#8216;^$\\|^\\s*\\#&#8217; \/etc\/my.cnf<br \/>\n[client]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\n[mysqld]<br \/>\nport\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 3306<br \/>\nsocket\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \/tmp\/mysql.sock<br \/>\nskip-external-locking<br \/>\nkey_buffer_size = 256M<br \/>\nmax_allowed_packet = 1M<br \/>\ntable_open_cache = 256<br \/>\nsort_buffer_size = 1M<br \/>\nread_buffer_size = 1M<br \/>\nread_rnd_buffer_size = 4M<br \/>\nmyisam_sort_buffer_size = 64M<br \/>\nthread_cache_size = 8<br \/>\nquery_cache_size= 16M<br \/>\ndatadir = \/data\/mariadb-galera-10.0.21\/<br \/>\nquery_cache_size = 0<br \/>\nlog_bin = mysql-bin<br \/>\nbinlog_format = ROW<br \/>\nexpire_logs_days = 30<br \/>\ndefault_storage_engine = InnoDB<br \/>\ninnodb_autoinc_lock_mode = 2<br \/>\nwsrep_provider = \/usr\/lib64\/galera\/libgalera_smm.so<br \/>\nwsrep_cluster_address = &#8220;gcomm:\/\/cluster1,cluster2,cluster3&#8221;<br \/>\nwsrep_cluster_name = LegionMariadbGaleraCluster1<br \/>\nwsrep_node_address=&#8217;192.168.1.63&#8242;<br \/>\nwsrep_node_name = &#8216;cluster3&#8217;<br \/>\nwsrep_sst_method = rsync<br \/>\nwsrep_sst_auth = cluster3:test123<br \/>\nthread_concurrency = 8<br \/>\nserver-id = 3<br \/>\ninnodb_log_file_size = 64M<br \/>\ninnodb_log_buffer_size = 8M<br \/>\ninnodb_flush_log_at_trx_commit = 1<br \/>\ninnodb_lock_wait_timeout = 50<br \/>\n[mysqldump]<br \/>\nquick<br \/>\nmax_allowed_packet = 16M<br \/>\n[mysql]<br \/>\nno-auto-rehash<br \/>\n[myisamchk]<br \/>\nkey_buffer_size = 128M<br \/>\nsort_buffer_size = 128M<br \/>\nread_buffer = 2M<br \/>\nwrite_buffer = 2M<br \/>\n[mysqlhotcopy]<br \/>\ninteractive-timeout<\/p>\n<p>ISSUES<\/p>\n<p>Disable selinux<br \/>\nIptables off<\/p>\n<p>1018 16:36:28 [Warning] WSREP: (531d16f9, &#8216;tcp:\/\/0.0.0.0:4567&#8217;) address &#8216;tcp:\/\/192.168.1.60:4567&#8217; points to own listening address, blacklisting<br \/>\n151018 16:36:31 [Warning] WSREP: no nodes coming from prim view, prim not possible<br \/>\n151018 16:36:31 [Note] WSREP: view(view_id(NON_PRIM,531d16f9,1) memb {<br \/>\n531d16f9,0<br \/>\n} joined {<br \/>\n} left {<br \/>\n} partitioned {<br \/>\n})<br \/>\n151018 16:36:31 [Warning] WSREP: last inactive check more than PT1.5S ago (PT3.5051S), skipping check<br \/>\n151018 16:37:01 [Note] WSREP: view((empty))<br \/>\n151018 16:37:01 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)<br \/>\nat gcomm\/src\/pc.cpp:connect():161<br \/>\n151018 16:37:01 [ERROR] WSREP: gcs\/src\/gcs_core.cpp:long int gcs_core_open(gcs_core_t*, const char*, const char*, bool)():206: Failed to open backend connection: -110 (Connection timed out)<br \/>\n151018 16:37:01 [ERROR] WSREP: gcs\/src\/gcs.cpp:long int gcs_open(gcs_conn_t*, const char*, const char*, bool)():1379: Failed to open channel &#8216;LegionMariadbGaleraCluster1&#8217; at &#8216;gcomm:\/\/192.168.1.60,192.168.1.62,192.168.1.63&#8217;: -110 (Connection timed out)<br \/>\n151018 16:37:01 [ERROR] WSREP: gcs connect failed: Connection timed out<br \/>\n151018 16:37:01 [ERROR] WSREP: wsrep::connect() failed: 7<br \/>\n151018 16:37:01 [ERROR] Aborting<\/p>\n<p>151018 16:37:01 [Note] WSREP: Service disconnected.<br \/>\n151018 16:37:02 [Note] WSREP: Some threads may fail to exit.<br \/>\n151018 16:37:02 [Note] \/usr\/local\/mariadb\/bin\/mysqld: Shutdown complete<\/p>\n<p>151018 16:37:02 mysqld_safe mysqld from pid file \/data\/mariadb-galera-10.0.21\/\/cluster1.rmohan.com.pid ended<\/p>\n<p>[ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)<\/p>\n<p>When node1 starts MySQL, it tries to join an existing cluster. But because both nodes are currently down, there is no primary node available (see this page for a good and short explanation).<\/p>\n<p>So when a Galera Cluster must be started from &#8220;zero&#8221; again, the first node must be started with the &#8220;wsrep-new-cluster&#8221; command (exactly during the set up of a new cluster):<\/p>\n<p>service mysql start &#8211;wsrep-new-cluster<br \/>\n* Starting MariaDB database server mysqld\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [ OK ]<br \/>\n* Checking for corrupt, not cleanly closed and upgrade needing tables.<\/p>\n<p>10, modify the node configuration Cluster1<\/p>\n<p>[root@cluster1 ~]# sed -ri &#8216;s\/^(wsrep_cluster_address).*\/\\1 = &#8220;gcomm:\\\/\\\/cluster1,cluster2,cluster3&#8243;\/&#8217; \/etc\/my.cnf<br \/>\n[root@cluster1 ~]# service mysqld restart<br \/>\nShutting down MySQL&#8230;. SUCCESS!<br \/>\nStarting MySQL&#8230; SUCCESS!<br \/>\n[root@cluster1 ~]#<\/p>\n<p>11, the test cluster multi-master synchronization<br \/>\n[root@cluster1 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8216;USE mysql;<br \/>\nCREATE DATABASE LegionTestDataBase;<br \/>\nUSE LegionTestDataBase;<br \/>\nCREATE TABLE equipment ( id INT NOT NULL AUTO_INCREMENT, type VARCHAR(50), quant INT, color VARCHAR(25), PRIMARY KEY(id));<br \/>\nINSERT INTO equipment (type, quant, color) VALUES (&#8220;slide&#8221;, 2, &#8220;blue&#8221;);<br \/>\nFLUSH PRIVILEGES;<br \/>\nSELECT * FROM LegionTestDataBase.equipment;&#8217;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n[root@cluster1 ~]#<\/p>\n<p>INSERT FROM Cluster2<\/p>\n<p>root@cluster2 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8220;USE LegionTestDataBase;<br \/>\nSELECT * FROM LegionTestDataBase.equipment;&#8221;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n[root@cluster2 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8220;USE LegionTestDataBase;<br \/>\nINSERT INTO equipment (type, quant, color) VALUES (&#8216;swing&#8217;, 10, &#8216;yellow&#8217;);<br \/>\nSELECT * FROM LegionTestDataBase.equipment;&#8221;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 swing\u00a0\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0 yellow<br \/>\n[root@cluster2 ~]#<\/p>\n<p>INSERT FROM CLUSTER3<\/p>\n<p>[root@cluster3 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8220;USE LegionTestDataBase;<br \/>\nSELECT * FROM LegionTestDataBase.equipment;&#8221;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 swing\u00a0\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0 yellow<br \/>\n[root@cluster3 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8220;USE LegionTestDataBase;<br \/>\nINSERT INTO equipment (type, quant, color) VALUES (&#8216;Legion&#8217;, 20, &#8216;red&#8217;);<br \/>\nSELECT * FROM LegionTestDataBase.equipment;&#8221;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 swing\u00a0\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0 yellow<br \/>\n6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Legion\u00a0 20\u00a0\u00a0\u00a0\u00a0\u00a0 red<br \/>\n[root@cluster3 ~]#<\/p>\n<p>[root@cluster1 ~]# mysql -uroot -ptest123 &lt;&lt;&lt; &#8220;USE LegionTestDataBase; SELECT * FROM LegionTestDataBase.equipment;&#8221;<br \/>\nid\u00a0\u00a0\u00a0\u00a0\u00a0 type\u00a0\u00a0\u00a0 quant\u00a0\u00a0 color<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 slide\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blue<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 swing\u00a0\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0 yellow<br \/>\n6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Legion\u00a0 20\u00a0\u00a0\u00a0\u00a0\u00a0 red<br \/>\n[root@cluster1 ~]#<\/p>\n<p>After the above round of testing, multi-node cluster-wide primary MariaDB is OK. .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS 6.7 Linux compilation configure a multi-master MariaDB Galera Cluster for HA. <\/p>\n<p>Multi-master MariaDB Galera Cluster<\/p>\n<p>Summary Galera is essentially a wsrep provider (provider), relies on the wsrep API interface. Wsrep API defines a set of applications and replication callback call library to implement transaction database synchronization write set (writeset) replication, and similar applications. The [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,72,16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5370"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5370"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5370\/revisions"}],"predecessor-version":[{"id":5375,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5370\/revisions\/5375"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}