redis5.0以后版本 搭建集群

redis5.0以前为什么要用ruby?

因为在redis/src中有一个文件redis-trib.rb,是用Ruby写的,用来搭建redis集群(redis3.0版本时才开始支持集群),所以想要搭建redis集群需要有一个能执行.rb的Ruby运行环境。
同时ruby的运行又依赖redis.gem这个文件。
所以在5.0以前 集群的搭建需要 安装ruby环境,下载gem文件。

redis5.0以后的版本
集群搭建,不需要借助ruby
https://blog.csdn.net/qq_25215821/article/details/100997778

新版命令:
src/redis-cli --cluster create --cluster-replicas 1
ip1:6379 ip2:6380 ip3:6381
ip1:6382 ip2:6383 ip3:6384

坑-1: https://www.liangzl.com/get-article-detail-40471.html

      redis集群部署一直卡在  Waiting for the cluster to join ......  

   原因:redis集群总线端口为redis客户端端口加上10000,比如说你的redis 6379端口为客户端通讯端口,那么16379端口为集群总线端口

   解决:添加redis 集群总线端口 和每个redis实例的通信端口
坑-2
https://www.jianshu.com/p/7720c922dd80
      ERR] Node 192.168.10.204:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
解决:
  首先关闭redis
  其次如果之前redis有数据存在,flushall清空;
  然后关闭redis删除 redis目录如下文件: dump.rdb,nodes-6379.conf
  重启解决

5.0.2集群搭建:

https://blog.csdn.net/qq_25215821/article/details/100997778

猜你喜欢

转载自www.cnblogs.com/mjbenkyo/p/12078710.html