TencentDB for Redis allows you to create a replication group in the console and add master or read-only instances to it, so as to implement consistent data sync in a one-master or multi-master architecture within the replication group.
- Instance role: You need to assign different roles to instances in a replication group, including master instance and read-only instance.
- Master instance: It provides data read/write access and is used to write the business data.
- Read-only instance: It provides the data read-only access and is used for read-only data operations or disaster recovery.
- IP address: Each instance in a replication group has a separate IP address, which can be accessed independently.
- Master/Replica switch: Automatic failover can be performed between master and replica nodes in each instance. However, it is not supported between master and read-only instances.
- Global replication supports instances running on 4.0 Standard Architecture, 4.0 Cluster Architecture, 5.0 Standard Architecture, and 5.0 Cluster Architecture.
- The current version of the global replication feature supports both single-AZ and multi-AZ instances.
- If instances in a replication group are in the same region, no additional fees will be incurred.
- For cross-region data replication within a replication group, bandwidth fees will be incurred. For more information, see Billing Overview.
Creating Global Replication Group
- Log in to the TencentDB for Redis console.
- Select Global Replication on the left sidebar.
- On the Redis - Global Replication page on the right, click Create Replication Group.
- In the Create Replication Group pop-up window, configure the following parameters and click OK.
> !The Redis kernel of the master instance specified during replication group creation must be upgraded to the Global Replication Edition. After the upgrade is completed, one or multiple momentary disconnections lasting 5 seconds will occur.
||Name of the replication group to be created. Enter a name as prompted.
||Brief description of the replication group. You can enter any characters to distinguish the group from others.
||Replication group creation test|
|Master Instance Region
||Select the region of the master instance in the replication group.
|Select Master Instance
||Select the master instance in the replication group. The version, architecture, and memory capacity of the selected instance will be displayed, and you need to confirm whether the specification meets your requirements.
- Return to the Redis - Global Replication page, and you can see the newly created replication group in the replication group list.
Click before the name of the replication group to show its instance list, where you can view the status of the master instance. You can use the master instance after the system upgrades its kernel to the Global Replication edition.
Adding Instance to Replication Group
After creating a replication group, you can add instances in the same or different regions and assign master and read-only instance roles to the added instances as needed to implement data sync.
- An instance newly added to a replication group will sync data from the master instance node, and it cannot be manipulated or accessed before the full data is synced.
- Once an instance is added to a replication group, its kernel edition will be upgraded, and one or multiple momentary disconnections will occur after the upgrade.
- You have created a global replication group, and it is in Running status.
- You have created an instance to be added to the replication group. Its compatible Redis version and architecture must be the same as those of the master instance specified during replication group creation, its memory capacity must be greater than or equal to the used capacity of the master instance, and it must be in Running status.
- If you want to specify the instance to be added as a master instance, it must have at least two replica nodes.
- When you add the first instance to a replication group, you don't need to clear the data. When adding subsequent instances, be sure to clear the data.
The first instance is divided into two cases: the master instance added to a newly created replication group, or the first instance added to an existing replication group after all instances in it are removed.
- In the instance list on the Redis - Global Replication page, select the target replication group.
- In the Operation column of the replication group, click Add Instance.
- In the Add Instance pop-up window, read the notes carefully, configure the following parameters, and click OK.
- Region: Select the region of the target instance.
- Select Instance: Select the target instance.
- Instance Role: Assign a role (master instance or read-only instance) to the target instance.
The instance role is not limited when you add an instance to a replication group. Set the role to master or read-only instance as needed.
- Return to the Redis - Global Replication page. In the replication group list, click before the name of the target replication group to show its instance list, where you can see the newly added instance.
You can add multiple instances to a replication group as needed and then sync data between them.
Notes on Availability
Cross-region disaster recovery
A master instance and a read-only instance can be added to a replication group to set up a cross-region disaster recovery system. However, the system will not automatically perform failover, which can only be manually performed in the console or through TencentCloud API. For detailed directions, see Switching Instance Role.
No matter whether a replication group has one or multiple master instances, when replication is interrupted, the system will not set them as read-only instances or perform other operations; instead, it will automatically resume the replay of incremental logs after instance recovery. To ensure data consistency, we recommend you configure alarms for replication exceptions and set master instances as read-only instances when a replication exception (such as replication interruption) occurs.