1

I am struggling to connect redis in sentinel mode using redis-cli.

I've tried:

redis-cli -h my_host -p my_port -a my_password

I randomly picked up one from 3 sentinel nodes to connect.

However, when logged in, it seems different with single mode redis, where I can manipulate dbs with set or hset commmand.

For instance, when I am typing:

select 0 (trying to select db 0)

It returns:

redis_sentinel_node_1_ip:port> select 0
(error) ERR unknown command `select`, with args beginning with: `0`

Could anyone help ?

Shu
  • 187
  • 1
  • 13

1 Answers1

2

While Sentinel and Redis use the same communication protocol (and live in the same executable as well), they support a very different set of commands. Afaik, Sentinel does not have the notion of multiple databases, so SELECT wouldn't have any sense there. If you just want to test a random command, you can use PING which is supported by both Redis and Sentinel.

You may want to review the set of commands Sentinel supports on the official docs.

Efran Cobisi
  • 6,138
  • 22
  • 22
  • 1
    thanks. It turns out that i was confused by the difference between the set of sentinel commands and the set of traditional redis commands. I've used `SENTINEL get-master-addr-by-name ` to discover the master node, and then, use the information returned, I was able to successfully connect to the master node. – Shu Jul 17 '20 at 09:53