1.先是下载最新版的redis: https://github.com/antirez/redis/archive/unstable.zip
2.解压后, 运行 make & make instal;
3.修改了redis.conf, 改动点:
port 6379 loglevel verbose cluster-enabled yes cluster-config-file nodes-<port>.conf cluster-node-timeout 15000
4.接着运行集群创建命令:
./redis-trib.rb create 192.168.1.13:6379
192.168.1.13:6390 192.168.1.15:6380 192.168.1.89:6381
结果操作一直阻塞在 Waiting for the cluster to join.........................
5.后来根据huangz的建议,使用add-node一个个的添加节点,来发现问题所在;最后还是没把192.168.1.15添加成功,此时还是没有提示错误信息。
此时在shell中用cluster info查看状态,显示为
192.168.1.13:6379> cluster info cluster_state:ok cluster_slots_assigned:16384 cluster_slots_ok:16384 cluster_slots_pfail:0 cluster_slots_fail:0 cluster_known_nodes:3 cluster_size:3 cluster_current_epoch:0 cluster_stats_messages_sent:116180 cluster_stats_messages_received:116179
6.接着尝试CLUSTER MEET方法来添加最后一个节点,出现了如下错误:
127.0.0.1:7000> cluster meet 192.168.1.15 6380 [7180] 25 Feb 14:20:45.429 - Accepted cluster node 192.168.1.13:36252 [7180] 25 Feb 14:20:45.429 # Bad message length or signature received from Cluster bus.
7. 到此时,集群已经有三个节点了,算是一个最小完整的集群。至于第四个节点没有添加成功的原因,还有待研究。