Help Center/ Distributed Cache Service/ FAQs/ Feature/ Does DCS for Redis Support Read/Write Splitting?
Updated on 2024-05-20 GMT+08:00

Does DCS for Redis Support Read/Write Splitting?

The following table describes DCS's support for read/write splitting.

Instance Type

Read/Write Splitting

Read/write splitting

Supported.

NOTE:

To implement read/write splitting without client configurations, use read/write splitting instances.

Redis Cluster

Read/write splitting can be configured and implemented on the client. For details, see Configuration.

Master/Standby Redis 4.0, 5.0, or 6.0 basic

Read/write splitting can be implemented on a client that is able to distinguish between read and write requests.

Other

Not supported.

Configuration

  • For a Redis Cluster instance, you can query all master and replica nodes by running the CLUSTER NODES command. The client will connect to replicas and configure read-only access on them.

    Run the following command to query cluster nodes:

    redis-cli -h {redis_address} -p {redis_port} -a {redis_password} cluster nodes

    Read-only configuration on replicas is achieved through the READONLY command.

  • For a master/standby DCS Redis 4.0/5.0/6.0 basic instance, there are two domain names displayed on the instance details page of the console: a read/write address (master node) and a read-only address (standby node). On the client, you can direct write requests to the read/write domain name and read requests to the read-only domain name.
  • For a read/write splitting instance, read/write splitting is implemented on the server side by default. Proxies distinguish between read and write requests, and forward write requests to the master node and read requests to the standby node. You do not need to perform any configuration on the client.