All Products
Search
Document Center

ApsaraDB for Redis:Enable read/write splitting

Last Updated:Jan 17, 2024

ApsaraDB for Redis provides the read/write splitting feature. After you enable read/write splitting for an instance, the instance can automatically identify read and write requests and forward them to corresponding nodes. This allows the instance to support high-concurrency read and write operations.

Prerequisites

  • The instance uses cloud disks.

  • The instance is an ApsaraDB for Redis Community Edition instance that runs Redis 5.0 or 6.0, or a DRAM-based or persistent memory-optimized instance of Tair.

  • The instance has a specification of 1 GB or higher.

Background information

The read/write splitting feature uses the star replication architecture where all read replicas synchronize data from the master node. This reduces synchronization latency. Read replicas can be used as replica nodes for data backup to ensure disaster recovery. You can specify up to five read replicas for an instance. For more information, see Read/write splitting instances.

Procedure

  1. 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 the instance ID.

  2. In the left-side navigation pane, click Read/Write Splitting Settings.

  3. Click Enable.

  4. In the Read/Write Splitting panel, set Number of Read Replicas. Valid values: 1 to 5.

    Note

    New read replicas have the same specifications as the instance.

  5. Check the order amount and click Pay.

  6. Complete the payment.

    After the payment is complete, the instance specifications begin to change and the instance enters the Changing Configuration state. Wait 1 to 5 minutes. If the specification change is complete, the instance enters the Running state. You can check the instance state on the details page of the instance.

    Important

    This operation may cause a transient connection that lasts for a few seconds on the instance. We recommend that you perform this operation during off-peak hours and make sure that your application can automatically reconnect to the instance.

Specify a custom number of read replicas

After read/write splitting is enabled for an instance, you can click Add Read Replica or Delete Read Replica on the Read/Write Splitting Settings page to change the number of read replicas for the instance.

Important

This operation may cause a transient connection that lasts for a few seconds on the instance. We recommend that you perform this operation during off-peak hours and make sure that your application can automatically reconnect to the instance.

FAQ

Unable to enable read/write splitting with error ECS cluster DbInstance does not support SecurityGroup

Cause: Cloud-native read/write splitting instances do not support the security group feature.

Solution: Check whether a security group is added to the instance as a whitelist. For more information about how to view and configure security groups, see Configure whitelists.

If a security group is added to the instance as a whitelist, add the IP addresses of the Elastic Compute Service (ECS) instances in the security group to the instance whitelist, remove the security group from the instance, and then enable read/write splitting.