Skip to main content

MySQL semi-sync cluster fault tolerance

By default, a MySQL semi-sync cloud 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 rest will be replicas.

note

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.

When adding replicas, consider the node placement type in the cluster.

Master node

By default, the cluster consists of one primary node: a master node. When connecting to the master node, all operations are available: read (SELECT) and write (INSERT, UPDATE, DELETE, and others).

All data changes on the master node are replicated to the replicas. The replication process does not affect the operation of the replicas and the master node.

Replicas

Replicas are exact copies of the master node. They are read-only (SELECT).

The presence of replicas in a cluster ensures its fault tolerance—if the master node stops working, one of the replicas will take over its role, and the cluster will continue to operate normally. When the master node is restored, it will take on the role of a replica. The master node address will change.

For clusters with replicas, an SLA applies: we guarantee 99.95% write availability and 99.99% read availability.

If there are no replicas in the cluster, it will be unavailable until the master node is restored. Data will not be lost.

We recommend that you create fault-tolerant clusters with replicas or add replicas to existing clusters.

Node placement type

The node placement type in a cluster depends on:

  • whether there are replicas in the cluster;
  • the type of pool where the cluster is located;
  • the number of segments in the pool;
  • configuration lines.

You can view the list of pools and segments in the Selectel infrastructure table in the Locations: countries, regions, availability zones, pools, and data center addresses manual.

There are four available node placement types:

  • Single-Segment;
  • Multi-Segment;
  • Single-AZ;
  • Multi-AZ.

Nodes are placed in a single segment of a single-zone pool. Applicable to:

  • for clusters without replicas;
  • clusters with replicas located in pools with only one segment;
  • clusters with replicas in configurations of the HighFreq and Dedicated lines.
note

For example, you have created a three-node cluster (one master node and two replicas) using the HighFreq configuration in the ru-2 pool. All nodes will be placed in one pool segment, for example, in ru-2c.

Change the number of replicas

You can increase or decrease the number of replicas. When changing the number of replicas, the cluster continues to work.

  1. In the control panel, in the top menu, click Products and select Cloud Databases.
  2. Open the Active tab.
  3. Open the cluster page → Settings tab.
  4. Click Edit configuration.
  5. In the Fault tolerance block, in the Number of nodes field, specify the new number of replicas. If there are no available addresses in the subnet to which the cluster is connected, the replica cannot be added — each new replica takes a new address in the subnet.
  6. Click Save.