tencent cloud

Feedback

Replica is read-only

Last updated: 2024-03-13 10:36:47

    Overview

    For service scenarios with frequent reads and infrequent writes, TencentDB for Redis allows you to designate read requests for hot datasets to replica nodes. This is known as the read-only replica, where read operations and write operations are routed to different database nodes. This avoids read-write conflicts, enhances the database's concurrency processing capabilities, and improves the overall system's performance and stability. For more information, see Read/Write Separation.

    Billing FAQs

    The read-only replica feature is currently available for free trial.

    Notes

    Enabling the read/write separation feature of a read-only replica may cause data inconsistency (data on the replica node lagging behind the primary node). Please confirm first if your service allows for such inconsistency.
    Disabling the read/write separation feature of a read-only replica may cause existing connections to be interrupted. It is recommended to perform this operation during off-peak business hours.

    Prerequisites

    The database instance is on v4.0 or above.
    The database instance is in Running status.

    Directions

    Enabling Read-Only Replica

    1. Log in to the TencentDB for Redis console.
    2. Above the Instance List on the right, select the region.
    3. In the Instance List, find the target instance.
    4. Click the Instance ID to enter the Instance Details page, click the Node Management tab.
    5. In the upper right corner of the Node Management page, click the icon
    
    next to the Read-Only Replica.
    
    6. In the pop-up dialog box, configure the Read-Only Replica node. For specific parameter information, see the table below.
    
    Parameter Name
    Parameter Description
    Account Name
    Set as Default account, that is, the system only enables read-only replicas for the default account.
    Command Permission
    Set as Read/Write permissions. The default account has read and write permissions.
    Read-Only Routing Policy
    By default, it is set as Replica Node, you can also select Master Node, or select both Replica Node and Primary Node. Read requests will be automatically load-balanced to the configured read-only nodes.
    Read-Only Local Node
    This parameter is displayed when the instance is deployed in multiple availability zones. Enable/disable reading local nodes only feature is fixed as Disabled. You can enable/disable this feature by configuring the reading-local-node-only parameter on the Parameter Configuration page in the console.
    Fees
    Currently available for free trial.
    7. Confirm the parameter configuration is correct, then click OK.
    8. When the Instance Status changes to Processing, wait for it to be Running. Under Instance Details page in the Specification Information zone, you can see that Read-Only Replica is marked as Enabled, indicating that read/write separation is now available.

    Disabling Read-Only Replica

    Note:
    If the read-only routing policy of the instance's custom account specifies that read requests be distributed to the replica node, you cannot directly disable the read-only replica feature. Please prioritize setting the read-only policy to primary node, then disable the read-only replica feature.
    1. Log in to the TencentDB for Redis console.
    2. Above the Instance List on the right, select the region.
    3. In the Instance List, find the target instance.
    4. Click the Instance ID to enter the Instance Details page, click the Node Management tab.
    5. In the upper right corner of the Node Management page, click the icon
    
    next to the Read-Only Replica.
    6. In the Disable Read-Only Replica dialogue box, understand the impact of disabling read-only replica, confirm the disable, click OK.
    7. Instance Status has been changed to In progress. Wait for it to be Running. In the Specification Information zone of the Instance Details page, you can see Read-Only Replica is marked as Not Enabled, indicating that the disabling process is complete.

    Command

    Once the Read-Only Replica is enabled, some commands will not be routed to the replica node, they will only be routed to the primary node. The specific commands are shown in the following table.
    Architecture Category
    Commands only routed to the primary node when Read/Write Separation is enabled.
    Standard Edition
    getdel,getex,set,setnx,setex,psetex,append,del,unlink,setbit,bitfield,setrange,incr,decr,rpush,lpush,rpushx,lpushx,linsert,rpop,lpop,brpop,brpoplpush,blpop,lset,ltrim,lrem,rpoplpush,sadd,srem,smove,spop,sinterstore,sunionstore,sdiffstore,sscan,zadd,zincrby,zrem,zremrangebyscore,zremrangebyrank,zremrangebylex,zunionstore,zinterstore,zscan,zpopmin,zpopmax,bzpopmin,bzpopmax,hset,hsetnx,hmset,hincrby,hincrbyfloat,hdel,hscan,incrby,decrby,incrbyfloat,getset,mset,msetnx,swapdb,move,rename,renamenx,expire,expireat,pexpire,pexpireat,scan,ping,multi,exec,discard,flushdb,flushall,sort,replconf,info,imonitor,persist,role,subscribe,unsubscribe,psubscribe,punsubscribe,publish,pubsub,watch,unwatch,restore,eval,evalsha,script,time,bitop,wait,command,readonly,lastsave,echo,geoadd,georadius,georadiusbymember,pfadd,pfmerge,pfdebug,xadd,xreadgroup,xgroup,xsetid,xack,xclaim,xautoclaim,xdel,xtrim,hello
    Cluster Edition
    getdel,getex,set,setnx,setex,psetex,append,del,unlink,setbit,bitfield,setrange,incr,decr,rpush,lpush,rpushx,lpushx,linsert,rpop,lpop,brpop,brpoplpush,blpop,lset,ltrim,lrem,rpoplpush,sadd,srem,smove,spop,sinterstore,sunionstore,sdiffstore,sscan,zadd,zincrby,zrem,zremrangebyscore,zremrangebyrank,zremrangebylex,zunionstore,zinterstore,zscan,zpopmin,zpopmax,bzpopmin,bzpopmax,hset,hsetnx,hmset,hincrby,hincrbyfloat,hdel,hscan,incrby,decrby,incrbyfloat,getset,mset,msetnx,swapdb,move,rename,renamenx,expire,expireat,pexpire,pexpireat,keys,scan,dbsize,ping,echo,lastsave,multi,exec,discard,flushdb,flushall,sort,info,persist,role,subscribe,unsubscribe,psubscribe,punsubscribe,publish,pubsub,watch,unwatch,restore,eval,evalsha,script,time,bitop,wait,geoadd,georadius,georadiusbymember,pfadd,pfmerge,pfdebug,xadd,xreadgroup,xgroup,xsetid,xack,xclaim,xautoclaim,xdel,xtrim,hello

    Related APIs

    API Name
    Description
    Enabling Read/Write Separation
    Disabling Read/Write Separation
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support