准备服务器和端口号
IP 地址 端口号 路径 192.168.0.201 6001 /app/redis-5.0.14/redis-6001 192.168.0.201 6002 /app/redis-5.0.14/redis-6002 192.168.0.202 6001 /app/redis-5.0.14/redis-6001 192.168.0.203 6002 /app/redis-5.0.14/redis-6002 192.168.0.203 6001 /app/redis-5.0.14/redis-6001 192.168.0.203 6002 /app/redis-5.0.14/redis-6002
所有节点操作:准备工作下载一些用到的工具:
yum -y install wget gcc
所有节点操作:下载 redis 的版本
下载用到的 redis 的源码包
wget https://download.redis.io/releases/redis-5.0.14.tar.gz
tar redis-5.0.14.tar.gz
cd redis-5.0.14
进行编译源码包会生成几个二进制文件:
mkdir -p /app/redis-5.0.14/redis-service
make PREFIX = "/app/redis-5.0.14/redis-service" install
开始进行配置配置文件
192.168.0.201 配置 2 个redis
第一个redis 的6001 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6001/redis-log
mkdir redis-6001/redis-conf
mkdir redis-6001/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6001/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6001/redis-6001.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6001/redis-log/redis-6001.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.201
# Redis 监听端口,默认为6379
port 6001
# 数据库快照文件(RDB)的文件名
dbfilename dump-6001.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6001/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6001.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6001/redis-conf/redis.conf
第二个redis 的6002 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6002/redis-log
mkdir redis-6002/redis-conf
mkdir redis-6002/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6002/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6002/redis-6002.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6002/redis-log/redis-6002.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.201
# Redis 监听端口,默认为6379
port 6002
# 数据库快照文件(RDB)的文件名
dbfilename dump-6002.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6002/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6002.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6002/redis-conf/redis.conf
192.168.0.202 配置 2 个redis
第一个redis 的 6001 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6001/redis-log
mkdir redis-6001/redis-conf
mkdir redis-6001/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6001/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6001/redis-6001.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6001/redis-log/redis-6001.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.202
# Redis 监听端口,默认为6379
port 6001
# 数据库快照文件(RDB)的文件名
dbfilename dump-6001.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6001/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6001.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6001/redis-conf/redis.conf
第二个redis 的6002 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6002/redis-log
mkdir redis-6002/redis-conf
mkdir redis-6002/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6002/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6002/redis-6002.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6002/redis-log/redis-6002.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.202
# Redis 监听端口,默认为6379
port 6002
# 数据库快照文件(RDB)的文件名
dbfilename dump-6002.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6002/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6002.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6002/redis-conf/redis.conf
192.168.0.203 配置 2 个redis
第一个redis 6001 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6001/redis-log
mkdir redis-6001/redis-conf
mkdir redis-6001/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6001/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6001/redis-6001.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6001/redis-log/redis-6001.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.203
# Redis 监听端口,默认为6379
port 6001
# 数据库快照文件(RDB)的文件名
dbfilename dump-6001.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6001/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6001.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6001/redis-conf/redis.conf
第二个redis 的6002 端口的操作
进行配置配置文件
cd /app/redis-5.0.14
mkdir -p redis-6002/redis-log
mkdir redis-6002/redis-conf
mkdir redis-6002/redis-data
cat << EOF >> /app/redis-5.0.14/redis-6002/redis-conf/redis.conf
protected-mode yes
tcp-backlog 511
timeout 600
tcp-keepalive 300
daemonize yes
supervised no
loglevel notice
syslog-enabled yes
syslog-ident "redis"
syslog-facility local0
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
repl-backlog-size 100mb
replica-priority 100
# 有一些危险操作我们给重写了一下如下面所示
rename-command FLUSHDB REDIS_FLUSHDB
rename-command FLUSHALL REDIS_FLUSHALL
rename-command CONFIG REDIS_CONFIG
rename-command SHUTDOWN b840dd429941cc15f59
rename-command KEYS REDIS_KEYS
maxmemory 30gb
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
cluster-enabled yes
cluster-node-timeout 15000
cluster-require-full-coverage no
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
activedefrag no
active-defrag-ignore-bytes 100mb
# 下面的操作个节点都不一样 !!!!!!!!!!!!!!!!!!!!
# Redis 服务器进程 ID 文件位置
pidfile /app/redis-5.0.14/redis-6002/redis-6002.pid
# Redis 服务器日志文件位置
logfile /app/redis-5.0.14/redis-6002/redis-log/redis-6002.log
# 绑定 IP 地址 这个需要更具业务进行配置
bind 192.168.0.203
# Redis 监听端口,默认为6379
port 6002
# 数据库快照文件(RDB)的文件名
dbfilename dump-6002.rdb
# RDB和AOF 快照文件的保存路径
dir /app/redis-5.0.14/redis-6002/redis-data
# 集群配置文件的保存路径
cluster-config-file nodes-6002.conf
# Redis 连接密码
requirepass 1231
# 主从同步时的密码
masterauth 1231
EOF
进行启动 redis
cd /app/redis-5.0.14
./redis-service/bin/redis-server ./redis-6002/redis-conf/redis.conf
统一进行验证是否启动成功:
配置启动成功后开始进行初始化集群
cd /app/redis-5.0.14
./redis-service/bin/redis-cli --cluster create 192.168 .0.201:6001 192.168 .0.202:6001 192.168 .0.203:6001 192.168 .0.201:600 192.168 .0.202:6002 192.168 .0.203:6002 -a '1231' --cluster-replicas 1 --cluster-yes
[ root@localhost redis-5.0.14]
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>> > Performing hash slots allocation on 6 nodes.. .
Master[ 0 ] -> Slots 0 - 5460
Master[ 1 ] -> Slots 5461 - 10922
Master[ 2 ] -> Slots 10923 - 16383
Adding replica 192.168 .0.202:6002 to 192.168 .0.201:6001
Adding replica 192.168 .0.203:6002 to 192.168 .0.202:6001
Adding replica 192.168 .0.201:6002 to 192.168 .0.203:6001
M: a7225e5a8e0679b817d6dcd61c6fbe3d536d9773 192.168 .0.201:6001slots:[ 0 -5460] ( 5461 slots) master
M: 89899b803c16440a6e76ca40013d3398efb65d12 192.168 .0.202:6001slots:[ 5461 -10922] ( 5462 slots) master
M: c3a32ea951879ac21e08734be9fd8d2f79479962 192.168 .0.203:6001slots:[ 10923 -16383] ( 5461 slots) master
S: f219764395e53d5bc34fe1d556dfa57023a0357a 192.168 .0.201:6002replicates c3a32ea951879ac21e08734be9fd8d2f79479962
S: 239963029f6aafedf873301a27d9156b6ff12dfa 192.168 .0.202:6002replicates a7225e5a8e0679b817d6dcd61c6fbe3d536d9773
S: 4c803454f7cf6b372c955728665ca2f914aaf65b 192.168 .0.203:6002replicates 89899b803c16440a6e76ca40013d3398efb65d12
>> > Nodes configuration updated
>> > Assign a different config epoch to each node
>> > Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
.. ..
>> > Performing Cluster Check ( using node 192.168 .0.201:6001)
M: a7225e5a8e0679b817d6dcd61c6fbe3d536d9773 192.168 .0.201:6001slots:[ 0 -5460] ( 5461 slots) master1 additional replica( s)
S: 239963029f6aafedf873301a27d9156b6ff12dfa 192.168 .0.202:6002slots: ( 0 slots) slavereplicates a7225e5a8e0679b817d6dcd61c6fbe3d536d9773
S: 4c803454f7cf6b372c955728665ca2f914aaf65b 192.168 .0.203:6002slots: ( 0 slots) slavereplicates 89899b803c16440a6e76ca40013d3398efb65d12
M: c3a32ea951879ac21e08734be9fd8d2f79479962 192.168 .0.203:6001slots:[ 10923 -16383] ( 5461 slots) master1 additional replica( s)
M: 89899b803c16440a6e76ca40013d3398efb65d12 192.168 .0.202:6001slots:[ 5461 -10922] ( 5462 slots) master1 additional replica( s)
S: f219764395e53d5bc34fe1d556dfa57023a0357a 192.168 .0.201:6002slots: ( 0 slots) slavereplicates c3a32ea951879ac21e08734be9fd8d2f79479962
[ OK] All nodes agree about slots configuration.
>> > Check for open slots.. .
>> > Check slots coverage.. .
[ OK] All 16384 slots covered.
[ root@localhost redis-5.0.14]
redis-6001 redis-6002 redis-service
进行验证是否创建成功集群:
[ root@localhost redis-5.0.14]
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168 .0.201:6001 > CLUSTER nodes
239963029f6aafedf873301a27d9156b6ff12dfa 192.168 .0.202:6002@16002 slave a7225e5a8e0679b817d6dcd61c6fbe3d536d9773 0 1705559824067 5 connected
4c803454f7cf6b372c955728665ca2f914aaf65b 192.168 .0.203:6002@16002 slave 89899b803c16440a6e76ca40013d3398efb65d12 0 1705559826071 6 connected
c3a32ea951879ac21e08734be9fd8d2f79479962 192.168 .0.203:6001@16001 master - 0 1705559825000 3 connected 10923 -16383
89899b803c16440a6e76ca40013d3398efb65d12 192.168 .0.202:6001@16001 master - 0 1705559824000 2 connected 5461 -10922
f219764395e53d5bc34fe1d556dfa57023a0357a 192.168 .0.201:6002@16002 slave c3a32ea951879ac21e08734be9fd8d2f79479962 0 1705559825067 4 connected
a7225e5a8e0679b817d6dcd61c6fbe3d536d9773 192.168 .0.201:6001@16001 myself,master - 0 1705559823000 1 connected 0 -5460
192.168 .0.201:6001 >