1.创建6个conf文件
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 yes
cluster-config-file nodes-6000.conf
cluster-node-timeout 20000
#节点本机IP,可以写局域网IP
cluster-announce-ip 124.70.179.58
cluster-announce-port 6000
cluster-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 yes
cluster-config-file nodes-6001.conf
cluster-node-timeout 20000
cluster-announce-ip 124.70.179.58
cluster-announce-port 6001
cluster-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 yes
cluster-config-file nodes-6002.conf
cluster-node-timeout 20000
cluster-announce-ip 123.60.140.214
cluster-announce-port 6002
cluster-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 yes
cluster-config-file nodes-6003.conf
cluster-node-timeout 20000
cluster-announce-ip 123.60.140.214
cluster-announce-port 6003
cluster-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 yes
cluster-config-file nodes-6004.conf
cluster-node-timeout 20000
cluster-announce-ip 124.71.195.156
cluster-announce-port 6004
cluster-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 yes
cluster-config-file nodes-6005.conf
cluster-node-timeout 20000
cluster-announce-ip 124.71.195.156
cluster-announce-port 6005
cluster-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
加入集群? 需要输入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
|