redis-cluster踩过的坑

例如服务器 ip:47.93.116.44

创建集群时,千万不能执行以下操作:./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 \

127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

因为这会导致,Jedis远程连接时,纵然你程序中配置是:47.93.116.44:7000,47.93.116.44:7001,47.93.116.44:7002,47.93.116.44:7003,47.93.116.44:7004,47.93.116.44:7005

Jedis创建连接时,会解析为 127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003,127.0.0.1:7004,127.0.0.1:7005,如果程序和redis cluster不在同一个服务器上,导致出错。

所以创建集群时一定要指定ip: ./redis-trib.rb create --replicas 1 47.93.116.44:7000 47.93.116.44:7001 \

47.93.116.44:7002 47.93.116.44:7003 47.93.116.44:7004 47.93.116.44:7005

你可能感兴趣的:(redis-cluster踩过的坑)