Search code examples
redisredis-cli

redis-cli NOAUTH error after redirected to slot


After enabling authentication for redis server, redis-cli returns (error) NOAUTH Authentication required. error every time request is redirected to a different slot. See below output

127.0.0.1:7000> auth admin password
OK
127.0.0.1:7000> get people::123
(nil)
127.0.0.1:7000> get people::234
-> Redirected to slot [7222] located at 127.0.0.1:7001
(error) NOAUTH Authentication required.
127.0.0.1:7001> auth admin password
OK
127.0.0.1:7001> get people::234
(nil)
127.0.0.1:7001> get people::123
-> Redirected to slot [1712] located at 127.0.0.1:7000
(error) NOAUTH Authentication required.
127.0.0.1:7000>

Any suggestions on how to fix this behavior?


Solution

  • The redis-cli's REPL-mode connection doesn't store the credentials that were input interactively. You'll have to invoke it like the below for it to automatically authenticate each connection:

    redis-cli -c --user admin --pass password