本文共 724 字,大约阅读时间需要 2 分钟。
为了节省机器,我们直接把6个Redis实例安装在同一台机器上(3主3从),只是使用不同的端口号。
机器IP 192.168.8.207更新:新版的cluster已经不需要通过ruby脚本创建,删掉了ruby相关依赖的安装
cd /usr/local/soft/redis-5.0.5mkdir redis-clustercd redis-clustermkdir 7291 7292 7293 7294 7295 7296
复制redis配置文件到7291目录
cp /usr/local/soft/redis-5.0.5/redis.conf /usr/local/soft/redis-5.0.5/redis-cluster/7291
修改7291的redis.conf配置文件,内容:
cd /usr/local/soft/redis-5.0.5/redis-cluster/7291>redis.confvim redis.conf
port 7291daemonize yesprotected-mode nodir /usr/local/soft/redis-5.0.5/redis-cluster/7291/cluster-enabled yescluster-config-file nodes-7291.confcluster-node-timeout 5000appendonly yespidfile /var/run/redis_7291.pid
注意,外网集群要添加这个配置:
# 实际给各节点网卡分配的IP(公网IP)cluster-announce-ip 47.xx.xx.xx# 节点映射端口cluster-ann
转载地址:http://hflrb.baihongyu.com/