MySQL sync cluster fault tolerance
By default, a MySQL sync Managed Database cluster consists of a single master node. To ensure cluster fault tolerance, you need to add replicas to it. In multi-node clusters, one node will be the master node, and the others will be replicas.
For example, if you have created a three-node cluster, the cluster will have one master node and two replicas. If you add more nodes, they will be replicas.
A MySQL sync cluster with replicas has limitations.
The node allocation type in a cluster depends on the presence of replicas in the cluster, the type of pool where the cluster is located, and the number of segments in the pool.
Master node
By default, a cluster consists of one primary node — the master node. When connected to the master node, all operations are available: reading (SELECT) and writing (INSERT, UPDATE, DELETE, and others).
All data changes on the master node are replicated to the replicas. The replication process does not affect the performance of the replicas and the master node.
Replicas
Replicas are full copies of the master node. They are only available for data reading (SELECT).
Having replicas in a cluster ensures its fault tolerance — if the master node stops working, its role will be transferred to one of the replicas, and the cluster will continue to operate normally. When the master node is restored, it will take on the role of a replica. Note that the address of the master node will change.
For clusters with replicas, the SLA applies — we guarantee a write availability of 99.95% and a read availability of 99.99%.
If a cluster has no replicas, it will be unavailable until the master node is restored. Data will not be lost.
We recommend creating fault-tolerant clusters with replicas or adding replicas to existing clusters.
Node placement
The type of node placement in a cluster depends on the number of replicas in the cluster, the type of pool where the cluster is located, and the number of segments in the pool:
-
Single-Segment — in one segment of a single-AZ pool. Applicable to:
For example, you created a three-node cluster (one master node and two replicas) in the HighFreq configuration line in the ru-2 pool. All nodes will be placed in one segment of the ru-2c pool.
- Multi-Segment — in different segments of a single-AZ pool. Applicable to clusters with replicas that are located in pools with multiple segments. Segments are located in different racks of the same data center. Nodes are distributed across segments sequentially;
For example, you created a four-node cluster (one master node and three replicas) in the ru-1 pool. The first three nodes will be placed sequentially in segments of the ru-1a, ru-1b, and ru-1c pools. The fourth node will be placed in the ru-1a segment. If you add a fifth node, it will be placed in the ru-1b pool segment.
-
Single-AZ — in one segment of a multi-AZ pool. Applicable to clusters without replicas in the ru-6 pool. If you add a replica to the cluster, the node placement type will change to Multi-AZ;
-
Multi-AZ — in different segments of a multi-AZ pool. Applicable to clusters with replicas in the ru-6 pool. Each pool segment is located in a separate data center. Nodes are distributed across segments sequentially.
For example, you created a four-node cluster (one master node and three replicas) in the ru-6 pool. The first three nodes will be placed sequentially in segments of the ru-6a, ru-6b, and ru-6c pools. The fourth node will be placed in the ru-6a segment. If you add a fifth node, it will be placed in the ru-6b pool segment.
You can view a list of pools and segments in the Servercore Infrastructure table in the Locations: countries, regions, availability zones, pools, and data center addresses instruction.
Change the number of replicas
You can increase or decrease the number of replicas. While you are changing the number of replicas, the cluster continues to run.
- In the Dashboard, on the top menu, click Products and select Managed Databases.
- Open the Active tab.
- Open the cluster page → Settings tab.
- Click Change configuration.
- In the Fault tolerance block, in the Number of nodes field, enter the new number of replicas. If there are no free addresses in the subnet to which the cluster is connected, you cannot add a replica, as each new replica occupies a new address in the subnet.
- Click Save.