All Products
Search
Document Center

ApsaraDB for Redis:Enable read/write splitting

Last Updated:Jul 04, 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.

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.

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 comes with at least 1 GB of memory.

  • The cluster mode is disabled for the instance.

  • The instance is deployed in a single zone.

Precautions

This operation may cause transient connections that last for a few seconds on the instance and trigger data migration in the background. Make sure that the write queries per second (QPS) of the instance is less than 100,000 during the operation. We recommend that you perform this operation during off-peak hours and make sure that your application can automatically reconnect to the instance.

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 Enable 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 configurations begin to change and the instance enters the Changing Configuration state. Wait for 1 minute to 5 minutes. If the configuration change is complete, the instance enters the Running state. You can check the instance status on the details page of 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.

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: 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 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.