In the past, the cluster configuration of the database has been difficult, the difficulty lies in MySQL master and slave structure of high availability and read and write separation. Fortunately, the advent of galera/gr has greatly simplified the configuration of the entire cluster.
Here is a simple MySQL cluster topology diagram:
1.MySQL Middleware: Routing the Read and write operations of MySQL server (i.e., read-write separation); Sub-Library table (sharding)
- (1). MySQL Router:mysql officially provides a lightweight MySQL proxy (routing) that only provides read-write separation functionality, formerly SQL Proxy.
- (2). Proxysql: Similar to MySQL Router, lightweight MySQL agent, provides read-write separation function, also supports some sharding functions. There are two versions of the Percona version and the official version.
- (3). MAXSCALE:MARIADB middleware, similar to MySQL Router, Proxysql.
- These three are similar and are lightweight database middleware.
- (4). Amoeba, Cobar, Mycat: Provides many functions, the most important functions include read-write separation, sharding.
- These three sources are deeper, and are open source. Amoeba successor no, so Cobar out, Cobar successor, plus 2013 appeared a more serious problem, so Mycat stood on the shoulder of Cobar out.
2.MySQL High availability for master-slave replication: To elect a new master node at least for master-slave switchover or failure
- (1). MMM: Eliminated, there are some problems in consistency and high concurrency stability.
- (2). MHA: Some people still use, but there are some problems, but also tend to be eliminated MySQL master-slave high-availability program.
- (3). Galera: Leading the era of master-slave replication high-availability technology.
- (4). MariaDB Galera cluster:mariadb The realization of Galera.
- (5). Pxc:percona XtraDB Cluster, is the Percona of galera self-realization, with a lot of people.
- (6). Gr:group Replication,mysql officially provides the group replication technology (the technology introduced by MySQL 5.7.17), based on the Paxos algorithm.
- MariaDB Galera Cluster, PXC, GR are similar, each has advantages. But GR is revolutionary, based on native replication technology, which is rumored to be superior to PXC in many ways.
- MariaDB Galera Cluster, PXC and GR have made a number of mandatory restrictions for security and performance reasons. For example, based on Gtid replication, only InnoDB tables, each table must have a primary key, and so on. To use them to provide high availability for master-slave replication, you must understand their limitations.
MySQL Cluster structure description