MARIADB Galera Cluster Multi-master cluster installation record

Source: Internet
Author: User
Tags uuid rsync

1: Create Mariadb.repo
#vim/etc/yum.repos.d/mariadb.repo

# MariaDB 10.0 CentOS repository list-created 2013-08-23 13:08 UTC
# http://mariadb.org/mariadb/repositories/
[MARIADB]
Name = MariaDB
BaseURL = Http://yum.mariadb.org/10.0/centos6-amd64
Gpgkey=https://yum.mariadb.org/rpm-gpg-key-mariadb
Gpgcheck=1


#yum Install Mariadb-galera-server mariadb-client galera
The installation process appears
Transaction Check Error:
File/etc/my.cnf from Install the mariadb-common-10.0.12-1.el6.x86_64 conflicts with the file from the package mariadb-libs-1:5.5. 35-3.el7.x86_64
File/usr/share/mysql/charsets/index.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/armscii8.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/ascii.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp1250.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp1256.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp1257.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp850.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp852.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/cp866.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/dec8.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/geostd8.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/greek.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/hebrew.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/hp8.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/keybcs2.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/koi8r.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/koi8u.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/latin1.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/latin2.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/latin5.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/latin7.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/macce.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/macroman.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/charsets/swe7.xml from install of mariadb-common-10.0.12-1.el6.x86_64 conflicts with file from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/czech/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/danish/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/dutch/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/english/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/estonian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/french/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/german/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/greek/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/hungarian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/italian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/japanese/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/korean/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/norwegian-ny/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts With file from the package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/norwegian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/polish/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/portuguese/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/romanian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/russian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/serbian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/slovak/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with file From Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/spanish/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/swedish/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64
File/usr/share/mysql/ukrainian/errmsg.sys from install of mariadb-galera-server-10.0.12-1.el6.x86_64 conflicts with File from Package mariadb-libs-1:5.5.35-3.el7.x86_64

Error, possibly due to the previous installation of MySQL or mariadb caused by the conflict, the previous package was uninstalled
#yum-y-Remove mariadb-libs-1:5.5.35-3.el7.x86_64

And then install
#yum Install Mariadb-galera-server mariadb-client galera
OK, everything's going well now.

Copy the configuration file:
#cp/usr/share/mysql/wsrep.cnf/etc/my.cnf.d/

Node1 configuration file, modify a few options:
#vim/etc/my.cnf.d/wsrep.cnf

bind-address=127.0.0.1
Wsrep_provider=/usr/lib64/galera/libgalera_smm.so
Wsrep_cluster_address= "gcomm://"
Wsrep_sst_method=rsync
wsrep_sst_receive_address=192.168.150.137


Node1 Add SST users so that other node can synchronize data with this user
[Email protected] ~]# mysql-uroot-pxxxxxxxx
MariaDB [(None)]> > GRANT USAGE on * * to [e-mail protected] '% ' identified by ' sstpass ';
MariaDB [(None)]> > GRANT all privileges on * * to [email protected] '% ';
MariaDB [(None)]> > FLUSH privileges;
MariaDB [(None)]> > Quit

Node2 configuration file, modify a few options:
#vim/etc/my.cnf.d/wsrep.cnf

bind-address=127.0.0.1
Wsrep_provider=/usr/lib64/galera/libgalera_smm.so
Wsrep_cluster_address= "gcomm://192.168.150.137:4567"
Wsrep_sst_method=rsync
wsrep_sst_receive_address=192.168.150.136
Wsrep_sst_auth=sst:sstpass


Node1,node2 set up a firewall to open ports 3306 and 4567
#iptables-A input-i eno16777736-p TCP--dport 3306-j ACCEPT
#iptables-A input-i eno16777736-p TCP--dport 4567-j ACCEPT

Node1,node2 Close SELinux
#setenforce 0


Node1 Boot:
#/etc/init.d/mysql Bootstrap

Node2 Boot:
#/etc/init.d/mysql start
Discovery cannot start

View Logs
#more/var/lib/mysql/localhost.localdomain.err

140801 15:32:51 [Note] wsrep:new cluster View:global state:412b064f-1944-11e4-b9f8-a70b3179cc21:6, view# 5:primary, Nu Mber of Nodes:3, my index:0, protocol version 3
140801 15:32:51 [Warning] wsrep:gap in state sequence. Need state transfer.
140801 15:32:53 [note] wsrep:running: ' Wsrep_sst_rsync--role ' joiner '--address ' 127.0.0.1 '--auth ' Sst:sstpass '--datad IR '/var/lib/mysql/'--defaults-file '/etc/my.cnf '--parent ' 8388 "
140801 15:32:54 [Note] wsrep:prepared SST request:rsync|127.0.0.1:4444/rsync_sst
140801 15:32:54 [Note] wsrep:wsrep_notify_cmd is not defined, skipping notification.
140801 15:32:54 [Note] Wsrep:repl protocols:5 (3, 1)
140801 15:32:54 [Note] wsrep:service thread queue flushed.
140801 15:32:54 [Note] wsrep:assign initial position for Certification:6, protocol Version:3
140801 15:32:54 [Note] wsrep:service thread queue flushed.
140801 15:32:54 [Warning] wsrep:failed to prepare in incremental state transfer:local state UUID (00000000-0000-0000-00 00-000000000000) does not Match Group state UUID (412B064F-1944-11E4-B9F8-A70B3179CC21): 1 (Operation not permitted)
At Galera/src/replicator_str.cpp:prepare_for_ist (): 447. IST'll be unavailable.
140801 15:32:54 [Note] wsrep:member 0.0 (localhost.localdomain) Requested State transfer from ' *any* '. Selected 1.0 (Localhost.localdomain) (synced) as donor.
140801 15:32:54 [Note] wsrep:shifting PRIMARY, JOINER (to:6)
140801 15:32:54 [Note] wsrep:requesting state transfer:success, donor:1
140801 15:32:54 [Warning] wsrep:1.0 (localhost.localdomain): State transfer to 0.0 (Localhost.localdomain) failed:-255 ( Unknown Error 255)
140801 15:32:54 [ERROR] wsrep:gcs/src/gcs_group.c:gcs_group_handle_join_msg (): 723:will never receive state. Need to abort.
140801 15:32:54 [Note] WSREP:gcomm:terminating thread
140801 15:32:54 [Note] WSREP:gcomm:joining thread
140801 15:32:54 [Note] WSREP:gcomm:closing Backend


found that prepared SST REQUEST:RSYNC|127.0.0.1:4444/RSYNC_SST enabled 4444 ports for data synchronization, and this port is not set in Iptables, as before, set the
#iptables-A input-i eno16777736-p tcp--dport 4444-j ACCEPT


Test:
Add, delete, modify, and synchronize to other servers on any server. is now the master's mode, of course, if the table engine must be InnoDB, because Galera currently only supports InnoDB tables.


PS:
for a 2-node Galera cluster and other clustered software, you need to face the "brain crack" state in extreme situations.
In order to avoid this problem, Galera introduced "arbitrator (arbitrator)". There is no data on the
Arbiter node, which in the cluster acts as a quorum when the cluster splits, and there can be multiple "arbiter" nodes in the cluster. The
Moderator node joins the cluster in the following ways:
# garbd-a gcomm://192.168.1.137:4567-g my_wsrep_cluster-d
# Comment: Parameter description:-D: Run in daemon mode- A: Cluster address-G: Cluster name 9. Test whether the cluster is configured with parameters: Login database: See the following parameters:

MariaDB [(none)]> SHOW VARIABLES like ' wsrep_cluster_address ';
#如果配置了指向集群地址, the above parameter value should be the IP address of the cluster you specified

# This parameter checks whether
MariaDB [(none)]> show status like ' Wsrep_ready ';

# View the number of members of the cluster
MariaDB [(none)]> show status like ' Wsrep_cluster_size ';

# This view wsrep related parameters
MariaDB [(none)]> show status like ' wsrep% ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.