All Products
Search
Document Center

ApsaraDB for Redis:Enable read/write splitting

Last Updated:Apr 22, 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 enhances the overall performance and availability of the instance, meeting the requirements of high-concurrency read and write scenarios.

Prerequisites

  • The instance uses cloud disks.

  • The instance is an ApsaraDB for Redis Community Edition instance or a Tair DRAM-based or persistent memory-optimized instance.

  • 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. All read replicas come equipped with disaster recovery capabilities and can serve as replica nodes for data backup. You can select the number of read replicas based on your needs, with the available range being from 1 to 9. 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 9.

    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 for 1 minute 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

You can adjust the number of read replicas for a read/write splitting instance based on your business requirements. On the Read/Write Splitting Settings page, click Modify in the Actions column to adjust the number of read replicas.

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

Why is the ECS cluster DbInstance does not support SecurityGroup error reported when I try to enable read/write splitting for an instance?

Cause: If a security group is added to a cloud-native instance, read/write splitting cannot be enabled.

Solution: Check whether a security group is added to the instance as a whitelist. If a security group is added to the instance, add the corresponding IP addresses to a whitelist of the instance and remove the security group from the instance. For more information, see Configure whitelists. After you remove the security group, enable read/write splitting again.