Tair (Redis OSS-compatible) provides a set of in-house commands for cluster and read/write splitting instances connected in proxy mode. These commands let you target specific data shards directly—something the standard Redis INFO, SCAN, and MONITOR commands cannot do in a proxied multi-shard environment.
Prerequisites
Before you begin, ensure that you have:
A Tair cluster or read/write splitting instance connected in proxy mode
Syntax conventions
| Notation | Meaning |
|---|---|
UPPERCASE | Command keyword |
_italic_ | Variable — replace with an actual value |
[option] | Optional parameter; parameters without brackets are required |
A|B | Mutually exclusive parameters — specify only one |
... | The preceding parameter can be repeated |
Commands
INFO KEY
Syntax: INFO KEY _key_
Returns the hash slot and shard index that a key is assigned to. Use this command to check whether multiple keys land on the same slot — a requirement for multi-key commands in cluster instances.
The shard index returned byINFO KEYidentifies a data shard node in a cluster instance, not a database index used by theSELECTcommand.
Example
INFO KEY fooResponse
slot:12182 node_index:0IINFO
Syntax: IINFO _db_idx_ [_section_] [[_section_] ...]
Returns statistics for a specific data shard node, equivalent to running the native Redis INFO command on that shard.
| Parameter | Description | Valid values |
|---|---|---|
_db_idx_ | Index of the data shard node | 0 to (total number of cluster shards) |
_section_ | (Optional) One or more INFO sections to return | Same sections as the native INFO command |
Example
IINFO 1 ServerResponse
"# 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
Syntax: RIINFO _db_idx_ _ro_slave_idx_ [_section_] [[_section_] ...]
Returns statistics for a specific read-only replica in a read/write splitting instance, equivalent to running the native Redis INFO command on that replica.
| Parameter | Description | Valid values |
|---|---|---|
_db_idx_ | Index of the primary shard | Default: 0 |
_ro_slave_idx_ | Index of the read-only replica | 0 to 5 |
_section_ | (Optional) One or more INFO sections to return | Same sections as the native INFO command |
Example
RIINFO 0 0 ServerResponse
"# 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
Syntax: ISCAN _db_idx_ _cursor_ [MATCH _pattern_] [COUNT _count_]
Runs a key scan on a specific data shard node in a cluster instance, equivalent to the native Redis SCAN command.
| Parameter | Description | Valid values |
|---|---|---|
_db_idx_ | Index of the data shard node | 0 to (total number of cluster shards) |
_cursor_ | Cursor position; use 0 to start a new scan | Integer ≥ 0 |
MATCH _pattern_ | (Optional) Return only keys matching the pattern | Glob-style pattern, e.g., user:* |
COUNT _count_ | (Optional) Hint for how many keys to scan per call | Integer > 0 |
Example: scan all keys on shard 0
ISCAN 0 0Example: filter keys by pattern
ISCAN 0 0 MATCH user:*Response
1) "0"
2) 1) "user:1001"
2) "user:1002"
3) "user:1003"Example: limit keys scanned per call
ISCAN 0 0 COUNT 3Response
1) "0"
2) 1) "dkjfd"
2) "k"
3) "9z9"COUNTis a hint, not a hard limit. The actual number of keys returned may differ. Iterate until the cursor returns"0"to complete a full scan.
IMONITOR
Syntax: IMONITOR _db_idx_
Streams all commands processed by a specific data shard node in a cluster instance, equivalent to the native Redis MONITOR command.
| Parameter | Description | Valid values |
|---|---|---|
_db_idx_ | Index of the data shard node (Master) | 0 to (total number of cluster shards) |
Run IMONITOR through Telnet. The example below shows a complete session:
$ telnet <host> <port>
Trying <host>...
Connected to <host>.
AUTH <password>
+OK
IMONITOR 0
+OK
+1682652565.538228 [0 127.0.0.1:38618] "info" "all"
+1682652566.538231 [0 127.0.0.1:38618] "info" "all"
QUIT
+OKTo stop the stream, send QUIT.
RIMONITOR
Syntax: RIMONITOR _db_idx_ _ro_slave_idx_
Streams all commands processed by a specific read-only replica in a read/write splitting instance, equivalent to the native Redis MONITOR command.
| Parameter | Description | Valid values |
|---|---|---|
_db_idx_ | Index of the primary shard | Default: 0 |
_ro_slave_idx_ | Index of the read-only replica | 0 to 5 |
Run RIMONITOR through Telnet. The example below shows a complete session:
$ telnet <host> <port>
Trying <host>...
Connected to <host>.
AUTH <password>
+OK
RIMONITOR 0 1
+OK
+1682653310.571527 [0 127.0.0.1:59492] "info" "all"
+1682653311.571573 [0 127.0.0.1:59492] "info" "all"
QUIT
+OKTo stop the stream, send QUIT.