Configure Mariadb-galera-cluster process full record on CentOS7

Source: Internet
Author: User

Configure Mariadb-galera-cluster process full record on CentOS7

MySQL or MariaDB replication Galera Cluster

Galera Cluster:
Another multi-master model mechanism, no longer through the MySQL protocol through the read binary file implementation, but through the WRESP protocol in the global implementation of the underlying data slice replication, any node can read and write.
Percona-cluster:
Mariadb-cluster:

Advantages: When the network status is available, the basic real-time data synchronization between nodes, the log of MHA may be out of sync;

Features: Share read operation, front-end no need to read and write separation, just do load balancing.

Conditions: 1, at least three nodes, 2, can not install Mariadb-server.

Configuration file parameter explanation:
# CAT/ETC/MY.CNF.D/SERVER.CNF
[Galera]
# Mandatory Settings
#wsrep_provider = "/usr/lib64/galera/libgalera_smm.so" #插件;
#wsrep_cluster_address = "GCOMM://NODE_IP_ADDRESS1,NODE_IP_ADDRESS2,NODE_IP_ADDRESS3"
#wsrep_cluster_name =galera_cluster
#wsrep_node_address = #节点地址, can be omitted;
#wsrep_node_name = #节点名, can be omitted;
#binlog_format =row# binary log format;
#default_storage_engine =innodb
#innodb_autoinc_lock_mode =2# lock format;
#bind the address that the-address=0.0.0.0# listens to while working;

The first time you start, you need to initialize the cluster and execute the following command on any of these nodes:
/etc/init.d/mysql start--wsrep-new-cluster [--wsrep_cluster_name=galera_cluster]

Then start the other nodes normally:
/etc/init.d/mysql start


Configuration process:
OS:
# Cat/etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

Galera:
# Rpm-qa Mariadb-galera-server
Mariadb-galera-server-5.5.57-1.el7.centos.x86_64

Ip:
Node1 ip:192.168.1.77
Node2 ip:192.168.1.78
Node3 ip:192.168.1.79

Node1:
# Vim/etc/yum.repos.d/galera.repo
[Galera]
Name=galera
baseurl=http://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-5.5.57/yum/centos7-amd64/
Gpgcheck=0
# Scp/etc/yum.repos.d/galera.repo 192.168.1.78:/etc/yum.repos.d/
# Scp/etc/yum.repos.d/galera.repo 192.168.1.79:/etc/yum.repos.d/

Node1-3:
# yum Isntall mariadb-galera-server-y

Node1:
# RPM-QL Galera | Grep-i smm.so
/usr/lib64/galera/libgalera_smm.so
# VIM/ETC/MY.CNF.D/SERVER.CNF
[Galera]
Wsrep_provider=/usr/lib64/galera/libgalera_smm.so
Wsrep_cluster_address= "gcomm://192.168.1.77,192.168.1.78,192.168.1.79"
Binlog_format=row
Default_storage_engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
Wsrep_cluster_name= "Galera_cluster"
# scp/etc/my.cnf.d/server.cnf 192.168.1.78:/ETC/MY.CNF.D/SERVER.CNF
# scp/etc/my.cnf.d/server.cnf 192.168.1.79:/ETC/MY.CNF.D/SERVER.CNF
#/etc/init.d/mysql Start--wsrep-new-cluster

Node2-3:
#/etc/init.d/mysql Start

Node1:
# MySQL
Welcome to the MariaDB Monitor. Commands End With; or \g.
Your MariaDB Connection ID is 4
Server Version:5.5.57-mariadb-wsrep MariaDB Server, wsrep_25.21.r9949137
Copyright (c), Oracle, MariaDB Corporation Ab and others.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
MariaDB [galeradb]> Show status like ' wsrep_% ';
MariaDB [(None)]>create database galeradb;
Query OK, 1 row affected (0.63 sec)
MariaDB [(None)]> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| galeradb |
| Hellodb |
| Masterdb |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
MariaDB [(None)]> use galeradb;
MariaDB [galeradb]> CREATE TABLE tb1 (id int unsigned auto_increment NOT null primary key,name char (30));
MariaDB [galeradb]> INSERT into TB1 (name) VALUES (' Guo Jing '), (' Huang Rong ');
MariaDB [galeradb]> SELECT * from TB1;
+----+------------+
| ID | name |
+----+------------+
| 4 | Guo Jing |
| 7 | Huang Rong |
+----+------------+

Node2:
# MySQL
MariaDB [(None)]> show databases;
MariaDB [(None)]> use galeradb;
MariaDB [galeradb]> INSERT into TB1 (name) VALUES (' Yang Kang '), (' Mu niangci ');
MariaDB [galeradb]> SELECT * from TB1;
+----+------------+
| ID | name |
+----+------------+
| 4 | Guo Jing |
| 7 | Huang Rong |
| 11 | Yang Kang |
| 14 | Mu NIANGCI |
+----+------------+
Solution: For resolution of the ID discontinuity problem, you can invoke the tool builder at programming time.

Configure Mariadb-galera-cluster process full record on CentOS7

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.