All Products
Search
Document Center

Tair (Redis® OSS-Compatible):In-house commands for Tair instances in proxy mode

Last Updated:Nov 08, 2024

In addition to native Redis commands, Tair (Redis OSS-compatible) supports multiple commands developed in-house by Alibaba Cloud. You can use these commands in cluster or read/write splitting instances to manage the instances more efficiently.

Prerequisites

The instance is connected in proxy mode. For more information, see Features of proxy nodes.

Description

Note

The following list describes the conventions for the command syntax used in this topic:

  • Uppercase keyword: indicates the command keyword.

  • Italic text: indicates variables.

  • [options]: indicates that the enclosed parameters are optional. Parameters that are not enclosed by brackets must be specified.

  • A|B: indicates that the parameters separated by the vertical bars (|) are mutually exclusive. Only one of the parameters can be specified.

  • ...: indicates that the parameter preceding this symbol can be repeatedly specified.

INFO KEY

Command syntax: INFO KEY Key.

Description: This command queries the slot and data shard to which a specified key belongs. In Tair cluster instances, some commands require that all involved keys belong to the same slot. You can run this command to check whether the specified keys belong to the same slot or data shard.

Note

The node_index parameter in the output indicates a data shard in a cluster instance, which is different from DB in a SELECT statement.

Sample command:

INFO KEY foo

Sample output:

slot:12182 node_index:0

IINFO

Command syntax: IINFO db_idx [section] ....

Description: This command is similar to the Redis-native INFO command and is used to query the information of a data shard.

db_idx specifies the ID of the data shard that you want to query. The value ranges from 0 to the total number of data shards in a cluster instance. The usage of other parameters and the output are similar to those of the native INFO command. For more information, see INFO.

Sample command:

IINFO 1 Server

Sample output:

"# Server\r\nredis_version:5.0.13\r\nos:Linux\r\ntcp_port:6379\r\nuptime_in_seconds:547026\r\nuptime_in_days:6\r\nhz:10\r\nlru_clock:4869333\r\n"

RIINFO

Command syntax: RIINFO db_idx ro_slave_idx [section] ....

Description: This command is similar to the Redis-native INFO command, except that it is used only to query the information of a read replica in a read/write splitting instance.

db_idx specifies the ID of the master node in the read/write splitting instance. Default value: 0. ro_slave_idx specifies the ID of the read replica that you want to query. Valid values: 0 to 5. The usage of other parameters and the output are similar to those of the native INFO command. For more information, see INFO.

Sample command:

RIINFO 0 0 Server

Sample output:

"# Server\r\nredis_version:5.0.13\r\nos:Linux\r\ntcp_port:6379\r\nuptime_in_seconds:322575\r\nuptime_in_days:3\r\nhz:10\r\nlru_clock:4926418\r\n"

ISCAN

Command syntax: ISCAN db_idx cursor [MATCH pattern] [COUNT count].

Description: This command is similar to the Redis-native SCAN command and is used to run the SCAN command on a specified data shard in a cluster instance.

db_idx specifies the ID of the data shard that you want to query. The value ranges from 0 to the total number of data shards in a cluster instance. The usage of other parameters and the output are similar to those of the native SCAN command. For more information, see SCAN.

Sample command:

ISCAN 0 0 COUNT 3

Sample output:

1) "0"
2) 1) "dkjfd"
   2) "k"
   3) "9z9"

IMONITOR

Command syntax: IMONITOR db_idx.

Description: This command is similar to the Redis-native MONITOR command and is used to run the MONITOR command on a specified data shard in a cluster instance.

db_idx specifies the ID of the data shard (master node) that you want to query. The value ranges from 0 to the total number of data shards in a cluster instance. For more information, see Monitor.

Sample command:

Note

Run the IMONITOR and RIMONITOR commands over Telnet. To stop the execution of the IMONITOR and RIMONITOR commands, run the QUIT command.

IMONITOR 0

Sample output:

+OK
+1682652565.538228 [0 127.0.0.1:38618] "info" "all"
+1682652566.538231 [0 127.0.0.1:38618] "info" "all"

RIMONITOR

Command syntax: RIMONITOR db_idx ro_slave_idx.

Description: This command is similar to the Redis-native MONITOR command and is used to run the MONITOR command on a read replica in a read/write splitting instance.

db_idx specifies the ID of the master node in the read/write splitting instance. Default value: 0. ro_slave_idx specifies the ID of the read replica that you want to query. Valid values: 0 to 5. The usage of other parameters and the output are similar to those of the native MONITOR command. For more information, see Monitor.

Sample command:

RIMONITOR 0 1

Sample output:

+OK
+1682653310.571527 [0 127.0.0.1:59492] "info" "all"
+1682653311.571573 [0 127.0.0.1:59492] "info" "all"