环境搭建|Redis6.X?可?之Cluster集群和分?(三主三从)

1.创建6个conf文件
环境搭建|Redis6.X?可?之Cluster集群和分?(三主三从)
文章图片

bind 0.0.0.0 port 6000 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6000.log dbfilename "hub_6000.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6000.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6000.confcluster-node-timeout 20000#节点本机IP,可以写局域网IP cluster-announce-ip 124.70.179.58cluster-announce-port 6000cluster-announce-bus-port 16000/********************************************************/bind 0.0.0.0 port 6001 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6001.log dbfilename "hub_6001.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6001.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6001.confcluster-node-timeout 20000cluster-announce-ip 124.70.179.58cluster-announce-port 6001cluster-announce-bus-port 16001/********************************************************/bind 0.0.0.0 port 6002 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6002.log dbfilename "hub_6002.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6002.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6002.confcluster-node-timeout 20000cluster-announce-ip 123.60.140.214cluster-announce-port 6002cluster-announce-bus-port 16002/********************************************************/bind 0.0.0.0 port 6003 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6003.log dbfilename "hub_6003.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6003.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6003.confcluster-node-timeout 20000cluster-announce-ip 123.60.140.214cluster-announce-port 6003cluster-announce-bus-port 16003/********************************************************/bind 0.0.0.0 port 6004 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6004.log dbfilename "hub_6004.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6004.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6004.confcluster-node-timeout 20000cluster-announce-ip 124.71.195.156cluster-announce-port 6004cluster-announce-bus-port 16004/********************************************************/bind 0.0.0.0 port 6005 daemonize yes requirepass "pu8licw0rd" logfile ./redislog_6005.log dbfilename "hub_6005.rdb" dir "/usr/local/redis/data" appendonly yes appendfilename "appendonly1_6005.aof" masterauth "pu8licw0rd"cluster-enabled yescluster-config-file nodes-6005.confcluster-node-timeout 20000cluster-announce-ip 124.71.195.156cluster-announce-port 6005cluster-announce-bus-port 16005

分别启动6个节点进入到/usr/local/redis/bin目录
./redis-server ../config/customer_6000.conf
./redis-server ../config/customer_6001.conf
./redis-server ../config/customer_6002.conf
./redis-server ../config/customer_6003.conf
./redis-server ../config/customer_6004.conf
./redis-server ../config/customer_6005.conf

【环境搭建|Redis6.X?可?之Cluster集群和分?(三主三从)】加入集群需要输入yes
./redis-cli -a pu8licw0rd --cluster create 124.70.179.58:6000 124.70.179.58:6001 123.60.140.214:6002 123.60.140.214:6003 124.71.195.156:6004 124.71.195.156:6005 --cluster-replicas 1

    推荐阅读