By default, ApsaraDB for Redis Enhanced Edition (Tair) persistent memory-optimized instances use the asynchronous mode. You can change the
mode to semi-synchronous in the ApsaraDB for Redis console to improve data security.
Prerequisites
A persistent memory-optimized instance that runs the minor version 1.2.4 or later
is created.
Synchronization mode overview
Open source Redis uses the asynchronous replication mechanism for data synchronization
between the master and replica nodes. In this mode, after the master node processes
a request and returns the response to the client, the system synchronizes data from
the master node to the replica node. In this case, if a master-replica switchover
is triggered by an instance failure, data inconsistency may occur between the master
and replica nodes.
In semi-synchronous mode, after the master node processes a request, the system synchronizes
logs from the master node to the replica node. The master node does not respond to
the client until the master node receives a success response from the replica node.
This way, data consistency is guaranteed even if a master-replica switchover occurs.
The following figure shows how these two modes work.

Precautions
When you enable or disable semi-synchronous replication, full data replication is
triggered between the master and replica nodes. We recommend that you change the mode
during off-peak hours.
Procedure
- Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance that you
want to manage resides. Then, find the instance and click its ID.
- On the right side of the Basic Information section, click Change Synchronization Mode.
- In the panel that appears, configure the parameters described in the following table.
Parameter |
Description |
Synchronization Mode |
Default value: Asynchronous. Valid values:
- Semi-Synchronous: The master node responds to the client only after logs are received by the replica
node.
Important
- When you turn on or turn off Semi-Synchronous, full data replication is triggered between the master and replica nodes. We recommend
that you change the mode during off-peak hours.
- If the replica node is unavailable or the communication between the master and replica
nodes is abnormal, semi-synchronous replication degrades to asynchronous replication.
- Asynchronous: The asynchronous replication mechanism of open source Redis is used.
|
Degradation Threshold |
This parameter is available only if you set Synchronization Mode to Semi-Synchronous. Unit: ms. Valid values: 10 to 60000. Default value: 500.
If the latency of data synchronization between the master and replica nodes exceeds
the threshold, the synchronization mode is automatically changed to Asynchronous.
After the latency decreases to a value lower than the threshold, the synchronization
mode is automatically changed back to Semi-Synchronous.
|
- Click OK.