前言
一:報錯1與解決
1.1:報錯內容
-
Can I set the above configuration? (type 'yes' to accept): yes >>> Nodes configuration updated >>> Assign a different config epoch to each node >>> Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join ....................................................................................................................................................................................................................................................^C
1.2:問題解決
-
經過排查,發現配置文件中監聽的IP地址不可以有127.0.0.1的存在,只能監聽各本機的IP地址
-
經過修改並重啓服務後再次創建集羣立刻成功
-
[root@localhost opt]# vi /etc/redis/6379.conf '//修改配置文件' [root@localhost opt]# /etc/init.d/redis_6379 restart '//重啓' Stopping ... Waiting for Redis to shutdown ... Redis stopped Starting Redis server... [root@localhost opt]# netstat -antp |grep 6379 tcp 0 0 192.168.233.128:16379 0.0.0.0:* LISTEN 76973/redis-server tcp 0 0 192.168.233.128:6379 0.0.0.0:* LISTEN 76973/redis-server [root@localhost opt]# redis-cli --cluster create --cluster-replicas 1 192.168.233.128:6379 192.168.233.129:6379 192.168.233.130:6379 192.168.233.131:6379 192.168.233.132:6379 192.168.233.133:6379 '//重新創建集羣'
二:報錯2與解決
2.1:報錯描述
-
登陸集羣節點查看創建的鍵的時候出現報錯:(error) MOVED 9379 192.168.233.129:6379
-
[root@localhost opt]# redis-cli -h 192.168.233.130 -p 6379 192.168.233.130:6379> get cent (error) MOVED 9379 192.168.233.129:6379
2.2:報錯解決
-
通過添加-c參數,解決問題
-c:連接集羣結點時使用,此選項可防止moved和ask異常
-
重新連接查看,問題解決
[root@localhost opt]# redis-cli -h 192.168.233.130 -p 6379 -c 192.168.233.130:6379> get cent -> Redirected to slot [9379] located at 192.168.233.129:6379 "7.7"