Mainstream MySQL Cluster Implementation Architecture Advantages and Disadvantages and Analysis of Applicable Scenarios

This article mainly analyzes and summarizes several current mainstream MySQL cluster architecture implementation methods and their advantages and disadvantages. It is hereby issued for your reference, study and common progress. If there is something wrong, please let me know~
1. Master-slave replication architecture MHA
MHA Master High Availability Manager and Tools for MySQL is a MySQL high availability management tool written in Perl language by a MySQL expert in Japan, which aims to maintain the high availability and data consistency of the Master master database.
MHA is currently a relatively mature solution for MySQL high availability and is widely used in a large number of enterprises. Its biggest feature is that it can repair the difference log between multiple slaves, and finally make all slaves keep the data consistent, and then select a slave database as the new master, and point other slaves to it.
    When the master fails, the MHA will randomly select one of the multiple slaves to act as the new master, or specify a slave to be the master first in the configuration file.
Its architecture is as follows, please refer to:

For a brief explanation of the above figure, please refer to:
1. In the MHA architecture, read-write separation, the best practice is to plan the read-write separation in advance during application development and design, and set two when using Connection pool, that is, read connection pool and write connection pool, or you can choose a compromise solution to introduce SQL Proxy;
2. For read load balancing, you can use tools such as F5, LVS, HAPROXY or SQL Proxy, as long as load balancing and fault checking can be achieved 3. MHA
Manager Node is mainly responsible for fully synchronizing the bin log to the slave library when the main library crashes, monitoring the status and switching of the main library and the standby library.
Second, the official cluster MySQLCluster Architecture
MySQL Cluster is an enterprise-level solution officially provided by Oracle. It adopts the data storage mode of no shared storage, which truly realizes the real-time synchronization of data in the cluster and the transparency of the database node failure to the application. The official promise is that MySQL Cluster can guarantee 99.999% availability of the database system.

For a brief explanation of the above figure, please refer to:
1. For read and write load balancing, you can use F5, LVS, HAPROXY or other SQL Proxy tools, as long as it can achieve load balancing and fault checking;
2. MySQL Cluster also Support Cluster and Sharding functions, generally design tables according to actual needs;
3. The NDB Cluster storage engine generally needs to be used for sharding tables; 4.
MGM node: The role is to manage other nodes in MySQL Cluster, such as providing configuration data, starting and Stop the node, run backup, etc., the failure itself will not affect MySQL Cluster;
5.SQL node: node used to access Cluster data;
6.NDB node: used to save Cluster data;
7.MySQL Cluster supports cluster-to-cluster Real-time synchronization between data centers, granularity can be down to the row level, and data center deployment can be achieved.
3. Open source distributed solution Cobar
Cobar is a distributed processing system for relational data developed by Alibaba B2B department. It can provide you with massive data services in a distributed environment like a traditional database. The main functions of Cobar are as follows:
1. Cobar supports horizontal splitting of a table into multiple copies and put them into different libraries to achieve horizontal splitting of tables;
2. Cobar also supports placing different tables into different libraries;
3 .In most cases, the above two methods will be mixed and used;
4. Cobar can automatically send a heartbeat to the MySQL connected to the backend to judge the MySQL running status. Once the operation is abnormal, Cobar can automatically switch to the standby machine.
For a brief explanation of the above figure, please refer to:
1. Cobar supports both the cluster cluster function and the sharding data slicing function. Generally, a mashup method is adopted according to actual needs;
2. Cobar realizes load balancing and back-end nodes for application requests. 3. MySQL master and standby databases should be set to master-master two-way synchronization mode, that is, MySQL M01 and MySQL S01 must be set to master-master synchronization mode .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325774858&siteId=291194637