目录
1、退出redis-cli后,执行命令。不要登录状态下使用CLUSTER ADDSLOTS 分配
2、槽位号范围{1000...2000}中,{}里面是两个点,不是三个点。{1000..2000}
环境
CentOS 版本:CentOS 7 Minimal (7.7.1908)
Redis版本:redis-5.0.7
问题:
redis 分配槽位失败,提示:(error) ERR Invalid or out of range slot
或者提示:(error) NOAUTH Authentication required.
过程和解决方法
redis-cli 登录状态下 用CLUSTER ADDSLOTS 命令添加提示错误:
[root@admin131 bin]# redis-cli -p 7002 -h 192.168.42.131 -c -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.42.131:7002> CLUSTER ADDSLOTS {10923...16383}
(error) ERR Invalid or out of range slot
192.168.42.131:7002> CLUSTER ADDSLOTS {10923..16383}
(error) ERR Invalid or out of range slot
退出redis-clli。再执行。
192.168.42.131:7002> quit
[root@admin131 bin]# redis-cli -h 192.168.42.131 -p 7002 cluster addslots {10923..16383}
(error) NOAUTH Authentication required.
提示错误:(error) NOAUTH Authentication required.
redis.conf配置文件因为设置了密码,因此需要带上密码参数:
redis-cli -h 192.168.42.131 -p 7002 -a 123456 cluster addslots {10923..16383}
查看集群节点情况:
192.168.42.131:7002> cluster nodes
已经正常分配到槽位。
总结:
1、退出redis-cli后,执行命令。不要登录状态下使用CLUSTER ADDSLOTS 分配
2、槽位号范围{1000...2000}中,{}里面是两个点,不是三个点。{1000..2000}
3、设置了登录密码的,执行命令时,需要带上密码参数:
redis-cli -h 192.168.42.131 -p 7002 -a xxxxxx(在redis.conf中设置的密码) cluster addslots {10923..16383}