Besides native Redis commands, ApsaraDB for Redis supports 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 only contain 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 DB. You can run this command by following this syntax:
      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 different from the node index in the topology of an instance. This issue has been fixed in the latest version. If your instance is an earlier version, you can 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 the DBs 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. You can run this command by following this syntax:
    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 IINFO, but only in read/write splitting scenarios. This command specifies the idx value as the identifier of the read replica where you want to run the INFO command. If you use this command on instances other than cluster read/write splitting instances, the system returns an error. You can run this command by following this syntax:
    riinfo db_idx ro_slave_idx [section]
  • ISCAN: You can run this command to specify the DB 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. You can run this command by following this syntax:
    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. You can run this command by following this syntax:
    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 supports read/write splitting scenarios. You can run this command by following this syntax:
    rimonitor db_idx ro_slave_idx
    Note Before you run IMONITOR and RIMONITOR, use telnet to make sure that your application is connected with the target ApsaraDB for Redis instance. To terminate these commands, run the QUIT command.