redis-cli NOAUTH 错误重定向到插槽后

redis-cli NOAUTH error after redirected to slot

为redis服务器启用身份验证后,每次将请求重定向到不同的插槽时都会出现redis-cli returns (error) NOAUTH Authentication required.错误。见下面的输出

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>

关于如何解决此问题有什么建议吗?

redis-cli 的 REPL 模式连接不存储交互式输入的凭据。您必须像下面这样调用它才能自动验证每个连接:

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