ApsaraDB for Redis supports native Redis commands and certain Redis commands developed by Alibaba Cloud. You can use these commands to manage cluster instances or read/write splitting instances of ApsaraDB for Redis.

Description

  • 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 following this syntax: info [section]. When you run certain commands for cluster instances of ApsaraDB for Redis, 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. Follow this syntax to run the command:
      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, upgrade the minor version. For more information, see Upgrade the minor version.
    • The INFO KEY command returns the node indexes of shard servers on cluster instances. These shard servers are different from databases that are used in the SELECT command.
  • IINFO: You can run this command to specify the node of ApsaraDB for Redis to run the INFO command. This command is similar to the INFO command. Follow this syntax to run the command:
    iinfo db_idx [section]

    In this command, db_idx supports the range of [0, 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 a node of ApsaraDB for Redis, you can run the IINFO command or check the instance topology in the console.

  • RIINFO: You can run this command in a similar way as you run the IINFO command, but only in read/write splitting mode. 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 instances that are not in read/write splitting mode, the system returns an error. Follow this syntax to run the command:
    riinfo db_idx ro_slave_idx [section]
  • ISCAN: You can run this command to specify the node of a cluster 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, nodecount]. You can obtain the nodecount value by running the INFO command or by checking the instance topology in the console. Follow this syntax to run the command:
    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, nodecount). You can obtain the nodecount value by running the INFO command or by checking the instance topology in the console. Follow this syntax to run the command:
    imonitor db_idx
  • RIMONITOR: Similar to RIINFO, you can run this command to specify the read replica in a specified shard where you want to run the MONITOR command. This command is used in read/write splitting mode. Follow this syntax to run the command:
    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 target ApsaraDB for Redis instance. To terminate these commands, run the QUIT command.