The main contents of this article are as follows:
1. Background generated by group replication
2. Comparison of several replication technologies
3. Failure detection
4. Group members
5. Tolerance of failures
6. Node State of a member
7. Two modes of group replication
8. Donor nodes
1.
background generated by group replication
multiple The MySQL service consists of a common replication system that has the necessary maintenance management work. mysql packet replication technology uses the MySQL Intra-Group communication protocol to provide the following benefits:
(1) provide in-group MySQL automated coordination between services.
(2) supports single Primary System or multiple Primary Grouping of systems.
(3) single Primary The grouping of systems supports automated Primary elections.
(4) multiple Primary The grouping of systems supports automation of all Primary receive updates.
(5) The built-in grouping service provides consistency and availability of data within the group.
application Scenarios for MySQL Packet replication technology:
(1) elastic copy.
Meet MySQL Service host number of dynamic increase or decrease in demand.
(2) highly available shards. Shard Technology (sharding) as a popular scale - out (scale-out) approach, a MySQL Grouping can provide a highly available solution for each shard.
(3) instead of master-slave replication. There is a single point of pressure problem with normal master-slave replication in a given scenario, andMySQL Teaming provides a better scalability solution.
(4) Autonomous Systems. The built-in replication protocol supports automated MySQL teaming.
2.
comparison of several replication technologies
The differences between the different replication technologies provided by MySQL are as follows:
(1) asynchronous replication technology.
(2) semi-synchronous replication technology.
(3) packet replication technology.
3. Failure detection
Mysql packet replication provides a failure detection mechanism that can be used to discover and report which service is unresponsive, these are unresponsive mysql The service is presumed to have been hung off. This hang-off is only temporary as a suspicious situation. Then, if the group agrees that this suspicious condition is true, the grouping determines the mysql The service has actually lapsed. The other members of the last group make the mysql No response refers to a mysql service did not receive another under the specified time period Span style= "Font-family:calibri" >mysql response message for the service.
when a when the MySQL service is excluded from the group, the MySQL Service also detects that all other MySQL services are not responding, so the MySQL service will suspect all other MySQL The services were all hung up, but because they could not be confirmed, they could only be doubted, and in the end there was no result; In this case, the MySQL The service cannot perform any local transactions.
4.
Group members
MySQL packet replication relies on a distributed service called the MySQL Group member service, which is provided in the form of a MySQL built-in plug-in . Member Services define which MySQL services are online and are participating in a grouped transaction. The online status list is provided as a view, and each group member will be able to get a consistent view.
when a The group service will update this view when the MySQL service joins the MySQL Group, or when it leaves the group either actively or passively.
5.
tolerance of failures
The MySQL Packet member service uses PAXOS distributed algorithms to ensure distributed consistency. for an introduction to the PAXOS distributed algorithm, please refer to this page:https://baike.baidu.com/item/Paxos%20%E7%AE%97%E6%B3%95
The relationship between the number of members in the MySQL group and the tolerance for failure is determined by the following formula:
n = 2 x F + 1
where f is the tolerance of failure,n is the number of group members. The fault tolerance here is the maximum number of services that can fail without affecting the service's normal operation.
6.
node State of a member
The member's node state has the following types:
State |
Synchronous |
Describe |
ONLINE |
Is |
Node online. All grouping functions are supported. Transactions can be executed at any time. |
RECOVERING |
Whether |
Node online. is in the recovery state. Receiving data from donor (donor) . |
OFFLINE |
Whether |
The node is not in line. Does not belong to any grouping. |
ERROR |
Whether |
Error. Automatically set super_read_only to on, you need to manually modify the variable. |
Unreachable |
Whether |
Unreachable state. The node is considered unresponsive or has been hung out. |
7.
Two modes of grouping replication
the MySQL Packet replication technology provides two modes:
(1) single master mode.
in a group, only one member is in the Primary Mode While the other members are in secondary mode. Nodes in Primary mode provide read-write services, while nodes in secondary mode only provide read-only services.
(2) Multi-Master mode.
in a group, multiple members are in the Primary mode, the remaining members are in secondary mode. Nodes in Primary mode provide read-write services, while nodes in secondary mode only provide read-only services.
Single-master mode and multi-master mode are determined by the system variables.
Group_replication_single_primary_mode:
On: Single master mode.
OFF: Multi-master mode.
By default, group replication is single-master mode.
8.
Donor Nodes
in the in MySQL packet replication system, a node is required to provide data for replication by other nodes, the node that provides the data is called the Donor node (donor). The donor nodes are randomly generated, and in a replication system, each node rotates as the donor node. If the current donor node cannot connect, the fallback donor node is used. MySQL tries to ensure that the donor nodes are not the same each time it occurs.
MySQL Learning note 13 grouping replication related concepts