High availability of MySQL database based on galera cluster cluster

Source: Internet
Author: User

First, Galera cluster introduction 1, galera cluster:
    集成了Galera插件的MySQL集群,是一种新型的,数据不共享的,高度冗余的高可用方案,目前Galera Cluster有两个版本,分别是Percona Xtradb Cluster及MariaDB Cluster,Galera本身是具有多主特性的,即采用multi-master的集群架构,是一个既稳健,又在数据一致性、完整性及高性能方面有出色表现的高可用解决方案。       示:三个节点组成了一个集群,与普通的主从架构不同,它们都可以作为主节点,三个节点是对等的,称为multi-master架构,当有客户端要写入或者读取数据时,连接哪个实例都是一样的,读到的数据是相同的,写入某一个节点之后,集群自己会将新数据同步到其它节点上面,这种架构不共享任何数据,是一种高冗余架构。

2. Features
  • Multi-Master Architecture: a truly multi-point and read-write cluster that reads and writes data at any time, is up-to-date.
  • Synchronous replication: Data synchronization between different nodes of the cluster, no delay, no loss of data after the database has been hung out
  • Concurrent replication: Supports parallel execution for better performance when you apply data from a node
  • Failover: In the event of a database failure, switching is easy due to support for multi-point write
  • Hot plug: During the service, if the database is hung, as long as the monitoring program is found to be fast enough, no service time will be very small. The node itself has a very small impact on the cluster during a node failure
  • Automatic node cloning: In the case of new nodes, or downtime maintenance, incremental data or basic data do not need manual backup to provide, Galera cluster will automatically pull the online node data, eventually the cluster will become consistent
  • Transparent to application: maintenance of the cluster, transparent to the application
3. Working flow chart

4. Galera cluster including two components
  • Galera Replication Library (galera-3)
  • Wsrep:mysql extended with the Write Set Replication
    Wsrep Replication implementation: Percona-cluster Mariadb-cluster
Second, the experimental environment 1, Ready 3 virtual Host, CENTOS7 system, Configuration good Epel source 2, Vim Dvd.repo add the following warehouse

[MARIADB]
Name = MariaDB
BaseURL = https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-5.5.60/yum/centos7-amd64/
Gpgcheck=0

3. Direct Yum Installation

Yum Install Mariadb-galera-server

Third, the experiment Step 1, modify the configuration file, three nodes as Vim/etc/my.cnf.d/server.cnf

Wsrep_provider =/usr/lib64/galera/libgalera_smm.so
Wsrep_cluster_address= "gcomm://192.168.190.129,192.168.190.130.192.168.190.131"
Binlog_format=row
Default_storage_engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
The following configuration options are available
Wsrep_cluster_name = ' mycluster ' default My_wsrep_cluster
Wsrep_node_name = ' Node1 '
wsrep_node_address = ' 192.168.190.129 '

2. On first boot, you need to initialize the cluster and execute the command on one of the nodes:
/etc/init.d/mysql start--wsrep-new-cluster
3, normal start other nodes
service MySQL start
4. View related system variables and state variables in the cluster:
SHOW VARIABLES like ' wsrep_% ';

SHOW STATUS like ' wsrep_% ';

SHOW STATUS like ' wsrep_cluster_size ';

High availability of MySQL database based on galera cluster cluster

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.