tencent cloud

TencentDB for MySQL

Managing Delayed Replication of Read-Only Instance

Download
Focus Mode
Font Size
Last updated: 2026-06-16 11:42:06
This document describes how to configure delayed replication and start/stop replication for read-only instances through the MySQL console. By setting delayed replication (that is, the replication lag between read-only instances and the primary instance) and choosing to start recovery to a specified time point or GTID (Global Transaction Identifier) during the delay period, you can efficiently roll back data and achieve rapid failure backtracking.
Delayed Replication: Users can enable and configure the delayed replication time between read-only instances and the primary instance via the RO group configuration or the read-only instance management page.
Enabling/Disabling Replication: Allows users to manually start or stop data synchronization between read-only instances and the primary instance.

Delayed Replication Description

After delayed replication is enabled for a read-only instance, the instance is removed from the read-only group and its weight is set to 0. An alarm is also triggered for the removal. When you access the service using the read-only group's VIP address, traffic is not forwarded to the removed read-only instance. You can only access the instance using its own VIP address.
If the delayed removal feature is enabled for a read-only group, after delayed replication is disabled for a read-only instance, the instance's weight is restored only when its replication delay is less than the group's delay threshold. An alarm for the instance's removal recovery is triggered simultaneously with the weight restoration.
During the process of starting data replication to a specified location, operations such as restarting, adjusting configurations, performing version upgrades, or upgrading kernel minor versions cannot be performed concurrently.
If an RO group is upgraded to the Proxy Network Mode, delayed replication for read-only instances is not supported after the upgrade. For upgrade operations, see Network Forwarding Feature.

Enable Delayed Replication

Note:
Delayed replication for read-only instances is "disabled" by default. After you enable it, the "delayed replication time" will be displayed.

You Can Enable It via the RO Group Configuration

1. Log in to the TencentDB for MySQL console. In the instance list, click the primary instance ID to go to the instance management page.
2. On the instance management page, select the Read-Only Instance tab, click Configuration in the RO group column, and go to the RO group configuration page.

3. On the RO group configuration page, enable Delayed Replication and set the Replication Delay in the RO group information section, then click OK.
Delayed Replication: Can be achieved by setting delayed replication and during the delay period, selecting to initiate recovery to a specified time or GTID (Global Transaction Identifier), to achieve efficient data rollback and rapid fault backtracking.
Replication Delay: The replication delay between the read-only instance and the primary instance. Configurable range: 1 second - 259200 seconds.
Remove Delayed RO Instances: Whether to enable the removal policy. Removed instances have their weight automatically set to 0. If a read-only instance is removed due to exceeding the latency threshold, an alarm will be sent to the user. To configure alarms for read-only instance removal and specify recipients, see Alarm Feature.
Delay Threshold: Set a delay threshold for read-only instances. Instances exceeding this threshold will be removed from the RO group.
Least RO Instances: The minimum number of instances that must be retained in the group. If the number of existing read-only instances is less than or equal to this minimum and the delay exceeds the threshold, none of the existing read-only instances will be removed.
Assign Read Weight: The RO group supports two weight assignment modes: Assigned by system and Custom. The weight value must be an integer between 0 and 100.
Load Rebalancing:
When Load Rebalancing is disabled, weight modifications only take effect for new connections. They do not change the read-only instances accessed by existing persistent connections and will not cause database disconnections.
When Load Rebalancing is enabled, all connections are disconnected for seconds. New connections are then load-balanced according to the configured weights.


Enable via the read-only instance management page

1. Log in to the TencentDB for MySQL console. On the instance list page, click the read-only instance ID or Manage in the Operation column to go to the read-only instance details page.
2. At the Instance Info > Delayed Replication section on the read-only instance details page, click Enable.

3. In the pop-up dialog box, set the delay time and click OK.
Note:
The delay time range is: 1 second - 259200 seconds.
Modifying the delay time of an RO instance will simultaneously modify that of other RO instances in the same RO group.


Modify Delayed Replication

Configuration Modification via Read-Only Instance RO Group

1. Log in to the TencentDB for MySQL console. In the instance list, click the primary instance ID to go to the instance management page.
2. On the instance management page, select the Read-Only Instance tab, click Configure in the RO group column, and go to the RO group configuration page.
3. On the RO group configuration page, modify the delay time and click OK.

Modify via the Read-Only Instance Management Page

1. Log in to the TencentDB for MySQL console. On the instance list page, click the read-only instance ID to go to the read-only instance details page.
2. On the read-only instance details page, choose Instance Info > Delayed Replication, and click the edit icon.

3. In the pop-up dialog box, set the delay time and click OK.

Disable Delayed Replication

Disabling Through RO Group of Read-Only Instances

1. Log in to the TencentDB for MySQL console. In the instance list, click the primary instance ID to go to the instance management page.
2. On the instance management page, select the Read-Only Instance tab, click Configure in the RO group column, and go to the RO group configuration page.
3. On the RO group configuration page, disable the button for Delayed Replication, and click OK.

Disable via Read-Only Instance Management Page

1. Log in to the TencentDB for MySQL console. On the instance list page, click the read-only instance ID to go to the read-only instance details page.
2. On the read-only instance details page, at Instance Info > Delayed Replication, click Disable.
3. In the pop-up dialog box, after it is confirmed that everything is correct, click OK.
Note:
Disable delayed replication, then the delayed replication time will be 0 seconds, which means that real-time data synchronization will be restored between the read-only instance and the primary instance.

Initiate Data Replication

Note:
The replication status of the read-only instance defaults to Normal. If delayed replication is configured by the user and data is accidentally deleted during the delayed replication period, you can use the position and GTID at the time of the misoperation to replicate the read-only instance to a position before the binary log file or GTID, thereby enabling the feature of quick data recovery.
1. Log in to the TencentDB for MySQL console. On the instance list page, click the read-only instance ID to go to the read-only instance details page.
2. On the read-only instance details page below, at Instance Info > Replication Status, click Start.
3. In the pop-up dialog box, click OK.
Note:
After replication is started, the read-only instance resumes data synchronization with the primary instance.
4. You can also go to Instance Info > Replication Operation and select Replay by Flashbacked Position. You can specify the start time to a specific point and the corresponding GTID. After the read-only instance is restored to a specific time point or the corresponding GTID, it will stop replication until it is switched to the normal startup mode, at which point replication will resume.
Time: The selectable time range is from the replication stop time to the current time of the primary database.
GTID: The selectable range includes all logs after the binary logs that have not been applied by the read-only instance. The instance server_uuid has a fixed length of 36 characters. The GTID format must be server_uuid:transaction_id.
Note:
If the entered binary log position has already been applied on the read-only instance or exceeds that of the primary instance, replication startup will fail.
If there are breakpoints in the binary logs when replication is started, it will cause replication startup to fail.
To prevent disk space exhaustion on the read-only instance when the replication process is stopped due to a delay, the IO thread of the read-only instance is paused when its disk capacity falls below 5GB.

5. During the process of replicating to the specified position, you can click Replaying after Replication Status to query task details, and the task details support refresh.
6. After replication is completed, click Enable after Replication Status for the read-only instance to resume replication.

Stop Data Replication

Note:
Only when the delayed replication feature is enabled is the operation to stop the replication feature allowed; otherwise, the Disable button is unavailable.
After replication is stopped, the IO/SQL threads are also stopped.
1. Log in to the TencentDB for MySQL console. On the instance list page, click the read-only instance ID to go to the read-only instance details page.
2. On the read-only instance details page below, at Instance Info > Replication Status, click Disable.

3. In the pop-up dialog box, after confirming that everything is correct, click OK.

FAQs

How to Obtain GTID?

We recommend that you obtain the binlog file by executing the flush log command to locate the position and GTID at the time of misoperation.

How to View Delay Time?

You can view the replication delay between the read-only instance and the primary instance at Instance Details > Instance Architecture Diagram in the console.


How to View Task Information for Starting Replication to the Specified Position?

You can view the progress and details of tasks on the task list page in the console.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback