用redis-cli进行数据操作报错(error) MOVED 的解决方法
报错示例:
(base) wdh@wdh:~$ redis-cli -h 172.17.0.1 -p 6391
172.17.0.1:6391> get name
(error) MOVED 5798 172.100.0.1:6392
172.17.0.1:6391>
1
2
3
4
报错原因:
没有用集群模式连接(连接节点命令 没有加 -c 参数)
解决办法:
用 -c 参数连接redis集群节点:redis-cli -c -h 172.17.0.1 -p 6391
(base) wdh@wdh:~$ redis-cli -c -h 172.17.0.1 -p 6391
172.17.0.1:6391> get name
-> Redirected to slot [5798] located at 172.100.0.1:6392
(nil)
172.100.0.1:6392> set name 1
OK
172.100.0.1:6392> get name
"1"
172.100.0.1:6392>
1
2
3
4
5
6
7
8
9
参考文章:
标题:redis集群报错:(error) MOVED 解决方法
https://blog.youkuaiyun.com/one312/article/details/104986528
redis集群报错:(error) MOVED 的解决方法
最新推荐文章于 2024-03-09 20:44:59 发布