Linux-redis-5.0集群配置

设备环境

每个redis 节点采用相同的相同的redis版本、相同的密码、硬件配置

所有redis服务器必须没有任何数据

10.0.0.17           centos7          redis5.0       

10.0.0.27           centos7          redis5.0 

10.0.0.37           centos7          redis5.0 

10.0.0.47           centos7          redis5.0 

10.0.0.57           centos7          redis5.0 

10.0.0.67           centos7          redis5.0 

1、配置文件修改

redis配置文件修改,redis.conf

手动修改

[root@centos7-liyj ~]#vim /etc/redis.conf
bind 0.0.0.0
masterauth 123456   #建议配置,否则后期的master和slave主从复制无法成功,还需再配置
requirepass 123456
cluster-enabled yes #取消此行注释,必须开启集群,开启后redis 进程会有cluster标识
cluster-config-file nodes-6379.conf #取消此行注释,此为集群状态文件,记录主从关系及
slot范围信息,由redis cluster 集群自动创建和维护
cluster-require-full-coverage no   #默认值为yes,设为no可以防止一个节点不可用导致整
个cluster不可能

复制到其他节点上

[root@centos7-liyj ~]#scp /apps/redis/etc/redis.conf 10.0.0.27:/apps/redis/etc/
The authenticity of host '10.0.0.27 (10.0.0.27)' can't be established.
ECDSA key fingerprint is SHA256:a8HZZS4TTvzQbF1/XJKDZvry1Lwa+9/jYIYXRPwqfIk.
ECDSA key fingerprint is MD5:41:d8:d4:69:09:2c:35:d3:0a:91:79:cd:0e:e5:10:14.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.27' (ECDSA) to the list of known hosts.
root@10.0.0.27's password: 
redis.conf                                                                            100%   60KB  18.5MB/s   00:00    
[root@centos7-liyj ~]#scp /apps/redis/etc/redis.conf 10.0.0.37:/apps/redis/etc/
The authenticity of host '10.0.0.37 (10.0.0.37)' can't be established.
ECDSA key fingerprint is SHA256:a8HZZS4TTvzQbF1/XJKDZvry1Lwa+9/jYIYXRPwqfIk.
ECDSA key fingerprint is MD5:41:d8:d4:69:09:2c:35:d3:0a:91:79:cd:0e:e5:10:14.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.37' (ECDSA) to the list of known hosts.
root@10.0.0.37's password: 
redis.conf                                                                            100%   60KB  27.3MB/s   00:00    
[root@centos7-liyj ~]#scp /apps/redis/etc/redis.conf 10.0.0.47:/apps/redis/etc/
The authenticity of host '10.0.0.47 (10.0.0.47)' can't be established.
ECDSA key fingerprint is SHA256:a8HZZS4TTvzQbF1/XJKDZvry1Lwa+9/jYIYXRPwqfIk.
ECDSA key fingerprint is MD5:41:d8:d4:69:09:2c:35:d3:0a:91:79:cd:0e:e5:10:14.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.47' (ECDSA) to the list of known hosts.
root@10.0.0.47's password: 
redis.conf                                                                            100%   60KB  29.3MB/s   00:00    
[root@centos7-liyj ~]#scp /apps/redis/etc/redis.conf 10.0.0.57:/apps/redis/etc/
The authenticity of host '10.0.0.57 (10.0.0.57)' can't be established.
ECDSA key fingerprint is SHA256:a8HZZS4TTvzQbF1/XJKDZvry1Lwa+9/jYIYXRPwqfIk.
ECDSA key fingerprint is MD5:41:d8:d4:69:09:2c:35:d3:0a:91:79:cd:0e:e5:10:14.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.57' (ECDSA) to the list of known hosts.
root@10.0.0.57's password: 
Permission denied, please try again.
root@10.0.0.57's password: 
redis.conf                                                                            100%   60KB  23.3MB/s   00:00    
[root@centos7-liyj ~]#scp /apps/redis/etc/redis.conf 10.0.0.67:/apps/redis/etc/
The authenticity of host '10.0.0.67 (10.0.0.67)' can't be established.
ECDSA key fingerprint is SHA256:a8HZZS4TTvzQbF1/XJKDZvry1Lwa+9/jYIYXRPwqfIk.
ECDSA key fingerprint is MD5:41:d8:d4:69:09:2c:35:d3:0a:91:79:cd:0e:e5:10:14.
Are you sure you want to continue connecting (yes/no)? yte^H^H^H
Please type 'yes' or 'no': yes
Warning: Permanently added '10.0.0.67' (ECDSA) to the list of known hosts.
root@10.0.0.67's password: 
Permission denied, please try again.
root@10.0.0.67's password: 
redis.conf                                                                            100%   60KB  42.1MB/s   00:00    

所有所有节点启动或重启redis服务

systemctl enable --now redis  #redis未启动,执行此行
systemctl  restart redis      #redis已经启动,重启即可

 

redis集群配置

创建集群

#命令redis-cli的选项 --cluster-replicas 1 表示每个master对应一个slave节点

[root@centos7-liyj ~]#redis-cli -a 123456 --cluster create 10.0.0.17:6379 10.0.0.27:6379 10.0.0.37:6379 10.0.0.47:6379 10.0.0.57:6379 10.0.0.67:6379 --cluster-replicas 1
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 10.0.0.57:6379 to 10.0.0.17:6379
Adding replica 10.0.0.67:6379 to 10.0.0.27:6379
Adding replica 10.0.0.47:6379 to 10.0.0.37:6379
M: 97b46220a05f4ec75a07ee0a468dc0a871d715a3 10.0.0.17:6379    #带M的为master
   slots:[0-5460] (5461 slots) master                      #当前master的槽位起始 和结束位
M: ec6ec291571a8d16629897b3aa0628ac5c161820 10.0.0.27:6379
   slots:[5461-10922] (5462 slots) master
M: bd51f66ca1a1b07be2f0f0fd7ae1f829475a6809 10.0.0.37:6379
   slots:[10923-16383] (5461 slots) master
S: 0f63f38aa1cf2f330a7d2f96c647f3d96533ea9a 10.0.0.47:6379    #带S的slave
   replicates bd51f66ca1a1b07be2f0f0fd7ae1f829475a6809
S: 04db5ec527aa1c3b62a8a743b145bb3e1467249d 10.0.0.57:6379
   replicates 97b46220a05f4ec75a07ee0a468dc0a871d715a3
S: 32e7a2cd069a3fbff823ac9661dd20bdc9fcc012 10.0.0.67:6379
   replicates ec6ec291571a8d16629897b3aa0628ac5c161820
Can I set the above configuration? (type 'yes' to accept): yes #输入yes自动创建集群
>>> 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 10.0.0.17:6379)
M: 97b46220a05f4ec75a07ee0a468dc0a871d715a3 10.0.0.17:6379
   slots:[0-5460] (5461 slots) master                      #已经分配的槽位
   1 additional replica(s)                                 #分配了一个slave
S: 0f63f38aa1cf2f330a7d2f96c647f3d96533ea9a 10.0.0.47:6379
   slots: (0 slots) slave                                  #slave没有分配槽位
   replicates bd51f66ca1a1b07be2f0f0fd7ae1f829475a6809     #对应的master的10.0.0.37的 ID
S: 32e7a2cd069a3fbff823ac9661dd20bdc9fcc012 10.0.0.67:6379
   slots: (0 slots) slave
   replicates ec6ec291571a8d16629897b3aa0628ac5c161820     #对应的master的10.0.0.27的ID
S: 04db5ec527aa1c3b62a8a743b145bb3e1467249d 10.0.0.57:6379
   slots: (0 slots) slave
   replicates 97b46220a05f4ec75a07ee0a468dc0a871d715a3     #对应的master的10.0.0.17的 ID
M: ec6ec291571a8d16629897b3aa0628ac5c161820 10.0.0.27:6379
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
M: bd51f66ca1a1b07be2f0f0fd7ae1f829475a6809 10.0.0.37:6379
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
[OK] All nodes agree about slots configuration.             #所有节点槽位分配完成
>>> Check for open slots...                                 #检查打开的槽位
>>> Check slots coverage...                                #检查插槽覆盖范围
[OK] All 16384 slots covered.                               #所有槽位(16384个)分配完成

查看主从状态

10.0.0.17 节点
[root@centos7-liyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:master
connected_slaves:1
slave0:ip=10.0.0.57,port=6379,state=online,offset=1204,lag=1
master_replid:7b55e11479093abac4b63c965839dbcff729a016
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

10.0.0.27节点
[root@centos7-liyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:master
connected_slaves:1
slave0:ip=10.0.0.67,port=6379,state=online,offset=1204,lag=0
master_replid:a45fc1d876fcd29a7f9877b60b7228102e8abb38
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

10.0.0.37节点
[root@centos7-liyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:master
connected_slaves:1
slave0:ip=10.0.0.47,port=6379,state=online,offset=1204,lag=1
master_replid:f226151c30ebce938d03e773f544b43b6fcbfe13
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

10.0.0.47节点
[root@centos7-liyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:slave
master_host:10.0.0.37
master_port:6379
master_link_status:up
master_last_io_seconds_ago:0
master_sync_in_progress:0
slave_repl_offset:1218
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:f226151c30ebce938d03e773f544b43b6fcbfe13
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

10.0.0.57节点
[root@centos7-liyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:slave
master_host:10.0.0.17
master_port:6379
master_link_status:up
master_last_io_seconds_ago:1
master_sync_in_progress:0
slave_repl_offset:1218
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:7b55e11479093abac4b63c965839dbcff729a016
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

10.0.0.67节点
[root@centos7-lyj ~]#redis-cli -a 123456 -c INFO replication
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Replication
role:slave
master_host:10.0.0.27
master_port:6379
master_link_status:up
master_last_io_seconds_ago:1
master_sync_in_progress:0
slave_repl_offset:1218
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:a45fc1d876fcd29a7f9877b60b7228102e8abb38
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1218
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:1218

 

验证集群状态

[root@centos7-lyj ~]#redis-cli -a 123456 cluster info
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:2
cluster_stats_messages_ping_sent:1284
cluster_stats_messages_pong_sent:1228
cluster_stats_messages_meet_sent:5
cluster_stats_messages_sent:2517
cluster_stats_messages_ping_received:1228
cluster_stats_messages_pong_received:1289
cluster_stats_messages_received:2517

 

 

模拟master故障,对应的slave节点自动提升为新的master

[root@centos7-liyj ~]#redis-cli -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> shutdown
not connected> exit
[root@centos7-liyj ~]#ss -tnl
State       Recv-Q Send-Q               Local Address:Port                              Peer Address:Port              
LISTEN      0      128                      127.0.0.1:6010                                         *:*                  
LISTEN      0      128                      127.0.0.1:6011                                         *:*                  
LISTEN      0      128                              *:22                                           *:*                  
LISTEN      0      100                      127.0.0.1:25                                           *:*                  
LISTEN      0      128                          [::1]:6010                                      [::]:*                  
LISTEN      0      128                          [::1]:6011                                      [::]:*                  
LISTEN      0      128                           [::]:22                                        [::]:*                  
LISTEN      0      100                          [::1]:25                                        [::]:*                  
[root@centos7-liyj ~]#redis-cli -a 123456 --cluster info 10.0.0.57:6379
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Could not connect to Redis at 10.0.0.17:6379: Connection refused
10.0.0.57:6379 (04db5ec5...) -> 0 keys | 5461 slots | 0 slaves.  #10.0.0.57为新的master
10.0.0.37:6379 (bd51f66c...) -> 0 keys | 5461 slots | 1 slaves.
10.0.0.27:6379 (ec6ec291...) -> 0 keys | 5462 slots | 1 slaves.
[OK] 0 keys in 3 masters.
0.00 keys per slot on average.

 

10.0.0.57节点的,提升为新的master节点的日志

1276:S 10 Jul 2022 15:04:17.681 # Connection with master lost.
1276:S 10 Jul 2022 15:04:17.681 * Caching the disconnected master state.
1276:S 10 Jul 2022 15:04:17.841 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:17.842 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:17.842 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:18.852 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:18.852 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:18.852 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:19.862 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:19.862 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:19.863 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:20.873 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:20.873 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:20.874 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:21.886 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:21.886 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:21.887 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:22.896 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:22.896 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:22.897 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:23.907 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:23.908 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:23.908 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:24.917 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:24.918 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:24.920 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:25.929 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:25.929 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:25.929 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:26.937 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:26.937 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:26.937 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:27.941 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:27.942 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:27.942 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:28.949 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:28.949 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:28.949 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:29.957 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:29.957 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:29.957 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:30.965 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:30.965 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:30.966 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:31.973 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:31.973 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:31.973 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:32.982 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:32.982 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:32.983 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:33.889 * Marking node 97b46220a05f4ec75a07ee0a468dc0a871d715a3 as failing (quorum reached).
1276:S 10 Jul 2022 15:04:33.990 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:33.990 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:33.990 # Start of election delayed for 985 milliseconds (rank #0, offset 2408).
1276:S 10 Jul 2022 15:04:33.990 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:34.995 * Connecting to MASTER 10.0.0.17:6379
1276:S 10 Jul 2022 15:04:34.995 * MASTER <-> REPLICA sync started
1276:S 10 Jul 2022 15:04:34.995 # Starting a failover election for epoch 7.
1276:S 10 Jul 2022 15:04:34.996 # Error condition on socket for SYNC: Connection refused
1276:S 10 Jul 2022 15:04:34.998 # Failover election won: I'm the new master.
1276:S 10 Jul 2022 15:04:34.998 # configEpoch set to 7 after successful failover
1276:M 10 Jul 2022 15:04:34.998 # Setting secondary replication ID to 7b55e11479093abac4b63c965839dbcff729a016, valid up to offset: 2409. New replication ID is 4e2742f9c9c73bb65ad9af1c06368e509e40ac0e
1276:M 10 Jul 2022 15:04:34.998 * Discarding previously cached master state.

 

恢复故障节点10.0.0.17 自动为slave节点

[root@centos7-liyj ~]#systemctl start redis
[root@centos7-liyj ~]#redis-cli -a 123456 -h 10.0.0.57
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
10.0.0.57:6379> info replication
# Replication
role:master
connected_slaves:1
slave0:ip=10.0.0.17,port=6379,state=online,offset=2534,lag=0
master_replid:4e2742f9c9c73bb65ad9af1c06368e509e40ac0e
master_replid2:7b55e11479093abac4b63c965839dbcff729a016
master_repl_offset:2534
second_repl_offset:2409
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:2534

10.0.0.17的日志信息

27675:C 10 Jul 2022 15:13:00.340 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27675:C 10 Jul 2022 15:13:00.340 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=27675, just started
27675:C 10 Jul 2022 15:13:00.340 # Configuration loaded
27675:C 10 Jul 2022 15:13:00.340 * supervised by systemd, will signal readiness
27675:M 10 Jul 2022 15:13:00.341 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
27675:M 10 Jul 2022 15:13:00.341 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
27675:M 10 Jul 2022 15:13:00.341 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
27675:M 10 Jul 2022 15:13:00.341 * Node configuration loaded, I'm 97b46220a05f4ec75a07ee0a468dc0a871d715a3
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in cluster mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 27675
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

27675:M 10 Jul 2022 15:13:00.341 # Server initialized
27675:M 10 Jul 2022 15:13:00.341 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
27675:M 10 Jul 2022 15:13:00.341 * DB loaded from disk: 0.000 seconds
27675:M 10 Jul 2022 15:13:00.341 * Ready to accept connections
27675:M 10 Jul 2022 15:13:00.343 # Configuration change detected. Reconfiguring myself as a replica of 04db5ec527aa1c3b62a8a743b145bb3e1467249d
27675:S 10 Jul 2022 15:13:00.343 * Before turning into a replica, using my master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
27675:S 10 Jul 2022 15:13:00.343 # Cluster state changed: ok
27675:S 10 Jul 2022 15:13:01.351 * Connecting to MASTER 10.0.0.57:6379
27675:S 10 Jul 2022 15:13:01.352 * MASTER <-> REPLICA sync started
27675:S 10 Jul 2022 15:13:01.353 * Non blocking connect for SYNC fired the event.
27675:S 10 Jul 2022 15:13:01.354 * Master replied to PING, replication can continue...
27675:S 10 Jul 2022 15:13:01.357 * Trying a partial resynchronization (request 1da938f0b130de8c9066694707f2c21a2d57475c:1).
27675:S 10 Jul 2022 15:13:01.358 * Full resync from master: 4e2742f9c9c73bb65ad9af1c06368e509e40ac0e:2408
27675:S 10 Jul 2022 15:13:01.358 * Discarding previously cached master state.
27675:S 10 Jul 2022 15:13:01.372 * MASTER <-> REPLICA sync: receiving 176 bytes from master
27675:S 10 Jul 2022 15:13:01.372 * MASTER <-> REPLICA sync: Flushing old data
27675:S 10 Jul 2022 15:13:01.373 * MASTER <-> REPLICA sync: Loading DB in memory
27675:S 10 Jul 2022 15:13:01.373 * MASTER <-> REPLICA sync: Finished with success

10.0.0.57的日志信息

1276:M 10 Jul 2022 15:13:01.327 * Clear FAIL state for node 97b46220a05f4ec75a07ee0a468dc0a871d715a3: master without slots is reachable again.
1276:M 10 Jul 2022 15:13:02.321 * Replica 10.0.0.17:6379 asks for synchronization
1276:M 10 Jul 2022 15:13:02.321 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '1da938f0b130de8c9066694707f2c21a2d57475c', my replication IDs are '4e2742f9c9c73bb65ad9af1c06368e509e40ac0e' and '7b55e11479093abac4b63c965839dbcff729a016')
1276:M 10 Jul 2022 15:13:02.321 * Starting BGSAVE for SYNC with target: disk
1276:M 10 Jul 2022 15:13:02.321 * Background saving started by pid 1353
1353:C 10 Jul 2022 15:13:02.322 * DB saved on disk
1353:C 10 Jul 2022 15:13:02.322 * RDB: 0 MB of memory used by copy-on-write
1276:M 10 Jul 2022 15:13:02.336 * Background saving terminated with success
1276:M 10 Jul 2022 15:13:02.336 * Synchronization with replica 10.0.0.17:6379 succeeded

 

posted @ 2022-07-10 14:59  goodbay说拜拜  阅读(187)  评论(0编辑  收藏  举报