栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

redis集群报 MOVED 7365 127.0.0.1:7002

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

redis集群报 MOVED 7365 127.0.0.1:7002

看到有好多的朋友在使用redis集群有时候会报下面的错误

[root@CentOSE src]# ./redis-cli -p 7001
127.0.0.1:7001> set a
(error) ERR wrong number of arguments for 'set' command
127.0.0.1:7001> set a 11
(error) MOVED 15495 127.0.0.1:7003
127.0.0.1:7001> set b 22
OK
127.0.0.1:7001> set c 45
(error) MOVED 7365 127.0.0.1:7002
127.0.0.1:7001> set d 14
(error) MOVED 11298 127.0.0.1:7003
127.0.0.1:7001> set name lishi
(error) MOVED 5798 127.0.0.1:7002
127.0.0.1:7001> set school qinghua
(error) MOVED 8455 127.0.0.1:7002
127.0.0.1:7001> 

同时网上有好多人给出了解决方案 好多只是讲了道理 但是怎么解决 基本全是重装

其实这个重装没有什么意义 就是复制 修改 没有什么编译性的东西 你弄100遍也没有什么用

真实原因是大家忽略了连接方式 用下面的就可以了 大家可以发现加了一个 -c参数 这个就表示 用集群的方式连接 这样就不会报上面那个 MOVED的错误了

[root@CentOSE src]# ./redis-cli -c -p 7001
127.0.0.1:7001> set c 16
-> Redirected to slot [7365] located at 127.0.0.1:7002
OK
127.0.0.1:7002> set a 13
-> Redirected to slot [15495] located at 127.0.0.1:7003
OK
127.0.0.1:7003> set b 26
-> Redirected to slot [3300] located at 127.0.0.1:7001
OK
127.0.0.1:7001> set name zhangshan
-> Redirected to slot [5798] located at 127.0.0.1:7002
OK
127.0.0.1:7002> set xiaoli rencai
-> Redirected to slot [4746] located at 127.0.0.1:7001
OK
127.0.0.1:7001> 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/885968.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号