redis 集群安装
redis-5版本的集群安装
1. 5版本往上就不再使用ruby去创建集群了。
2. 具体的创建步骤可以参见下面的博文。https://www.jianshu.com/p/e9eab2f4a564
3. redis集群开机自启: https://www.cnblogs.com/powerwu/articles/11606925.html
4. 启动命令
1. redis-server /usr/local/rediscluster/7001/redis.conf
2. redis-server /usr/local/rediscluster/7002/redis.conf
3. redis-server /usr/local/rediscluster/7003/redis.conf
4. redis-server /usr/local/rediscluster/7004/redis.conf
5. redis-server /usr/local/rediscluster/7005/redis.conf
6. redis-server /usr/local/rediscluster/7006/redis.conf
7. redis-cli -a cyclone --cluster create --cluster-replicas 1 192.168.88.130:7001 192.168.88.130:7002 192.168.88.130:7003 192.168.88.130:7004 192.168.88.130:7005 192.168.88.130:7006
5. 因代码创建集群总是报错,可以不带密码配置集群,然后手动设置密码
1. /app/data/redis/redis-6.2.7/src/redis-cli --cluster create 192.168.0.184:8002 192.168.0.184:8001 192.168.0.59:8001 192.168.0.59:8002 192.168.0.37:8001 192.168.0.37:8002 --cluster-replicas 1
2. [redis@16c32g-0007 ~]$ /app/data/redis/redis-6.2.7/src/redis-cli -c -p 8001
3. 127.0.0.1:8001> config set requirepass '$Qsj9YEFcY'
4. OK
5. 127.0.0.1:8001> config set masterauth '$Qsj9YEFcY'
6. OK
7. 127.0.0.1:8001> config rewrite
8. OK
9. 127.0.0.1:8001>