This document describes how to set delayed replication for read-only instances and enable/disable replication in the TencentDB for MySQL console. You can set delayed replication (i.e., delay between a read-only instance and its source instance) and select to replay by flashbacked position or global transaction identifier (GTID) during the delay to efficiently roll back data and fix failures.
Note:Delayed Replication is disabled for a read-only instance by default. If it is enabled, the delayed replication time will be displayed.
Log in to the TencentDB for MySQL console. In the instance list, click a source instance ID to enter the instance management page.
On the instance management page, select the Read-Only Instance tab, locate the desired RO group, and click Configuration to enter the RO group configuration page.
On the RO group configuration page, enable Delayed Replication, set the Replication Delay, and click OK.
You can set delayed replication and select to replay by flashbacked position or global transaction identifier (GTID) during the delay to efficiently roll back data and fix failures.
Replication Delay: You can configure the time of delayed replication between a read-only instance and its source instance. The value range is 1–259200 seconds.
Remove Delayed RO Instances: This option indicates whether to enable the removal policy. If a read-only instance is removed when its delay exceeds the threshold, its weight will be set to 0 automatically, and alarms will be sent (for more information on how to configure the read-only instance removal alarm and recipients, see Alarm Policies (TCOP)).
Delay Threshold: This sets a delay threshold for the read-only instance. When the threshold is exceeded, the instance will be removed from the read-only group.
Least RO Instances: This is the minimum number of instances that should be retained in the RO group. When there are fewer instances in the RO group, even if an instance exceeds the delay threshold, it will not be removed.
Assign Read Weight: The RO group supports two weight assignment methods: automatic assignment by the system and custom assignment. The weight value must be an integer between 0 and 100.
Load Rebalancing:
Modifying weight will only affect new loads if rebalancing is disabled. The operation has no impact on read-only instances accessed by existing persistent connections and does not cause momentary database disconnection.
If rebalancing is enabled, all connections to the database will be temporarily disconnected, and the loads of newly added connections will be balanced according to the set weights.
Note:The delay ranges from 1 to 259,200 seconds.
Read-Only instances in the same RO group share the same replication delay. If one instance is modified, the rest will be modified automatically at the same time.
Log in to the TencentDB for MySQL console and click a read-only instance ID in the instance list to enter the read-only instance details page.
On the read-only instance details page, click Modify in Deployment Info > Delayed Replication.
In the pop-up window, set the delay and click OK.
Log in to the TencentDB for MySQL console and click a read-only instance ID in the instance list to enter the read-only instance details page.
On the read-only instance details page, click Disable in Deployment Info > Delayed Replication.
In the pop-up dialog box, confirm that everything is correct and click OK.
Note:If delayed replication is disabled, the delayed replication time will be 0 seconds, that is, real-time data sync is resumed between the read-only instance and its source instance. >
Note:The Replication Status of a read-only instance is Normal by default. If you set delayed replication and delete data accidentally during the delayed replication time period, you can restore the read-only instance to the specified position or GTID of the binlog file to implement quick data restoration.
Log in to the TencentDB for MySQL console and click a read-only instance ID in the instance list to enter the read-only instance details page.
On the read-only instance details page, click Enable in Deployment Info > Replication Status.
In the pop-up window, click OK.
Note:Once the replication is enabled, the data sync between the read-only instance and the source instance will resume.
You can also select Replay by Flashbacked Position in Deployment Info > Operation. Then, data can be restored to the specified time point or corresponding GTID. After the restoration, replication of the read-only instance will be disabled until the start mode is switched to Replicate all.
server_uuid
is fixed at 36 bits, and the GTID must be in server_uuid:transaction_id
format.
Note:
- If the entered binlog position has already been applied on the read-only instance or is after the source instance position, replication will fail to be enabled.
- When you enable replication, if there is any breakpoint in the binlog, replication will fail to be enabled.
- To avoid overusing the disk space of a delayed read-only instance when replication is disabled for it, the I/O thread of the read-only instance will be paused when its available disk space drops below 5 GB.
During the process of replay by flashbacked position, you can click Replaying after Replication Status to query and refresh the task details.
After the replication is completed, click Enable after Replication Status, and the read-only instance can continue to replicate.
Note:
- Only after delayed replication is enabled can it be disabled; otherwise, the Disable button is grayed out.
- Once replication is disabled, I/O and SQL threads will also be ended.
We recommend you run the flush log
command to get the binlog file to locate the position and GTID of the maloperation.
You can view the delay between a read-only instance and its source instance on the instance details page in the console.
You can view the task progress and details on the task list page in the console.
Was this page helpful?