ApsaraDB for Redis ensures compatibility with native Redis commands and also supports specific Redis commands developed by Alibaba Cloud. You can use these commands to manage ApsaraDB for Redis cluster or read/write splitting instances.

Prerequisites

An ApsaraDB for Redis instance is created with proxy nodes. For more information, see Features of proxy nodes.

Redis commands developed by Alibaba Cloud

  • INFO KEY: You can run this command to query slots and databases (DBs) to which keys belong. The native Redis command INFO can contain only one optional section by using this syntax: info [section]. When you run specific commands on ApsaraDB for Redis cluster instances, all keys must be in the same slot. The INFO KEY command allows you to check whether keys are in the same slot or node. Usage:
      127.0.0.1:6379> info key test_key
      slot:15118 node_index:0
    Notice
    • In earlier versions, the INFO KEY command may return a node index that is different from the node index in the topology of an instance. This issue is fixed in the latest version. If you are using an instance of an earlier version, update the minor version. For more information, see Update the minor version.
    • The INFO KEY command returns the node indexes of shards on cluster instances. These shards are different from databases that are used in the SELECT command.
  • IINFO: You can run this command to specify the node of an ApsaraDB for Redis instance used to run the INFO command. This command is similar to the INFO command. Usage:
    iinfo db_idx [section]

    In this command, db_idx supports the range of 0 to nodecount. You can obtain the nodecount value by running the INFO command, and specify the section option in the same way as you specify this option for a native Redis database. To view the detailed information of a node in an ApsaraDB for Redis instance, you can run the IINFO command or check the instance topology in the ApsaraDB for Redis console.

  • RIINFO: You can run this command in a similar way as you run the IINFO command, but this command can be run only on read/write splitting instances. This command specifies the idx value as the identifier of the read replica where you want to run the INFO command. If you run this command on other instances, the system returns an error. Usage:
    riinfo db_idx ro_slave_idx [section]
  • ISCAN: You can run this command to specify the node of a cluster instance where you want to run the SCAN command. This command provides the db_idx parameter based on SCAN. The db_idx parameter supports the range of 0 to nodecount. You can obtain the nodecount value by running the INFO command or by checking the instance topology in the ApsaraDB for Redis console. Usage:
    iscan db_idx cursor [MATCH pattern] [COUNT count]
  • IMONITOR: Similar to IINFO and ISCAN, this parameter provides the db_idx parameter based on the MONITOR command. The db_idx parameter specifies the node where you want to run MONITOR. The db_idx parameter supports the range of 0 to nodecount. You can obtain the nodecount value by running the INFO command or by checking the instance topology in the ApsaraDB for Redis console. Usage:
    imonitor db_idx
  • RIMONITOR: Similar to RIINFO, you can run this command to specify the read replica where you want to run the MONITOR command in a specified shard. This command is used in read/write splitting instances. Usage:
    rimonitor db_idx ro_slave_idx
    Note Before you run the IMONITOR or RIMONITOR command, use telnet to make sure that your application is connected to the ApsaraDB for Redis instance. To terminate these commands, run the QUIT command.