redis主从复制,哨兵,集群

主从复制(目前是在一台服务器开启了多个端口模拟)

1,开启对应的端口
在这里插入图片描述

2,复制俩份redis.conf (多个服务器无需配置)

 cp /etc/redis.conf redis6380.conf

//修改端口号
port 6380
修改新的pid文件路径
pidfile “/var/run/redis_6380.pid”
指定新的日志文件路径
logfile “/var/log/redis/redis_6380.log”
#指定新的数据文件路径
dir /data/redis/redis6380/data/
指定新的转储文件路径
dbfilename “dump_6380.rdb”

启动从库服务
[root@i6rgnw0phucy7Z redis]# ./src/redis-server redis.conf//启动从库服务
[root@iZ2zeh3bjq6rgnw0phucy7Z redis]#  ps -ef|grep redis//查看redis服务
root     11366     1  0 16:39 ?        00:00:09 ./src/redis-server 127.0.0.1:7000
root     14438     1  0 17:24 ?        00:00:02 ./src/redis-server 127.0.0.1:7001
root     14940     1  0 17:31 ?        00:00:01 ./src/redis-server 127.0.0.1:6379
root     15731 22430  0 17:44 pts/1    00:00:00 grep --color=auto redis
设置主从
[root@iZ2zeh3bjq6rgnw0phucy7Z redis]# redis-cli -p 7000 //链接相关客户端
127.0.0.1:7000> slaveof 127.0.0.1 6379 //设置自己的老大(主机)
OK
127.0.0.1:7000> info replication //查看自己的身份信息
# Replication
role:slave //角色为从机
master_host:127.0.0.1//老大的IP
master_port:6379//老大的端口
master_link_status:up //老大的状态
master_last_io_seconds_ago:0
master_sync_in_progress:0
slave_read_repl_offset:975934
slave_repl_offset:975934
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
master_failover_state:no-failover
master_replid:960e229115355e8c2c26d8ff64a9b36d5582b78f
master_replid2:fa55b0272bbfd29df1bbebe14d62a5e5e3b2e1d2
master_repl_offset:975934
second_repl_offset:905357
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:900693
repl_backlog_histlen:75242
体验
127.0.0.1:6379> set name 56
OK
127.0.0.1:6379> keys *
1) "name"
[root@Z redis]# redis-cli -p 7000
127.0.0.1:7000> keys *
1) "name"
127.0.0.1:7000> set age 34 //从机只可读
(error) READONLY You can't write against a read only replica.

哨兵

每个服务器中创建sentinel.conf文件,文件填写内容为:sentinel monitor mymaster 127.0.0.1 6379 1。其中mymaster为监控对象起的服务器名称,1为当所有服务器中有1个哨兵认为主服务器宕机就开始迁移主机

sentinel全部配置

# Example sentinel.conf
# 哨兵sentinel实例运行的端口 默认26379
port 26379
# 哨兵sentinel的工作目录
dir /tmp
# 哨兵sentinel监控的redis主节点的 ip port
# master-name 可以自己命名的主节点名字 只能由字母A-z、数字0-9 、这三个字符".-_"组成。
# quorum 配置多少个sentinel哨兵统一认为master主节点失联 那么这时客观上认为主节点失联了
# sentinel monitor <master-name> <ip> <redis-port> <quorum>
sentinel monitor mymaster 127.0.0.1 6379 2
# 当在Redis实例中开启了requirepass foobared 授权密码 这样所有连接Redis实例的客户端都要提供
密码
# 设置哨兵sentinel 连接主从的密码 注意必须为主从设置一样的验证密码
# sentinel auth-pass <master-name> <password>
sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
# 指定多少毫秒之后 主节点没有应答哨兵sentinel 此时 哨兵主观上认为主节点下线 默认30秒
# sentinel down-after-milliseconds <master-name> <milliseconds>
sentinel down-after-milliseconds mymaster 30000
# 这个配置项指定了在发生failover主备切换时最多可以有多少个slave同时对新的master进行 同步,
这个数字越小,完成failover所需的时间就越长,
但是如果这个数字越大,就意味着越 多的slave因为replication而不可用。
可以通过将这个值设为 1 来保证每次只有一个slave 处于不能处理命令请求的状态。
# sentinel parallel-syncs <master-name> <numslaves>
sentinel parallel-syncs mymaster 1
# 故障转移的超时时间 failover-timeout 可以用在以下这些方面:
#1. 同一个sentinel对同一个master两次failover之间的间隔时间。
#2. 当一个slave从一个错误的master那里同步数据开始计算时间。直到slave被纠正为向正确的master那
里同步数据时。
#3.当想要取消一个正在进行的failover所需要的时间。
#4.当进行failover时,配置所有slaves指向新的master所需的最大时间。不过,即使过了这个超时,
slaves依然会被正确配置为指向master,但是就不按parallel-syncs所配置的规则来了
# 默认三分钟
# sentinel failover-timeout <master-name> <milliseconds>
bilibili:狂神说Java
社会目前程序员饱和(初级和中级)、高级程序员重金难求!(提升自己!)
Redis缓存穿透和雪崩
服务的高可用问题!
在这里我们不会详细的区分析解决方案的底层!
Redis缓存的使用,极大的提升了应用程序的性能和效率,特别是数据查询方面。但同时,它也带来了一
些问题。其中,最要害的问题,就是数据的一致性问题,从严格意义上讲,这个问题无解。如果对数据
的一致性要求很高,那么就不能使用缓存。
另外的一些典型问题就是,缓存穿透、缓存雪崩和缓存击穿。目前,业界也都有比较流行的解决方案。
sentinel failover-timeout mymaster 180000
# SCRIPTS EXECUTION
#配置当某一事件发生时所需要执行的脚本,可以通过脚本来通知管理员,例如当系统运行不正常时发邮件通知
相关人员。
#对于脚本的运行结果有以下规则:
#若脚本执行后返回1,那么该脚本稍后将会被再次执行,重复次数目前默认为10
#若脚本执行后返回2,或者比2更高的一个返回值,脚本将不会重复执行。
#如果脚本在执行过程中由于收到系统中断信号被终止了,则同返回值为1时的行为相同。
#一个脚本的最大执行时间为60s,如果超过这个时间,脚本将会被一个SIGKILL信号终止,之后重新执行。
#通知型脚本:当sentinel有任何警告级别的事件发生时(比如说redis实例的主观失效和客观失效等等),
将会去调用这个脚本,这时这个脚本应该通过邮件,SMS等方式去通知系统管理员关于系统不正常运行的信
息。调用该脚本时,将传给脚本两个参数,一个是事件的类型,一个是事件的描述。如果sentinel.conf配
置文件中配置了这个脚本路径,那么必须保证这个脚本存在于这个路径,并且是可执行的,否则sentinel无
法正常启动成功。
#通知脚本
# shell编程
# sentinel notification-script <master-name> <script-path>
sentinel notification-script mymaster /var/redis/notify.sh
# 客户端重新配置主节点参数脚本
# 当一个master由于failover而发生改变时,这个脚本将会被调用,通知相关的客户端关于master地址已
经发生改变的信息。
# 以下参数将会在调用脚本时传给脚本:
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
# 目前<state>总是“failover”,
# <role>是“leader”或者“observer”中的一个。
# 参数 from-ip, from-port, to-ip, to-port是用来和旧的master和新的master(即旧的slave)通
信的
# 这个脚本应该是通用的,能被多次调用,不是针对性的。
# sentinel client-reconfig-script <master-name> <script-path>
sentinel client-reconfig-script mymaster /var/redis/reconfig.sh # 一般都是由运维来配

启动哨兵

redis-sentinel sentinel.conf

优点:

1、哨兵集群,基于主从复制模式,所有的主从配置优点,它全有
2、 主从可以切换,故障可以转移,系统的可用性就会更好
3、哨兵模式就是主从模式的升级,手动到自动,更加健壮!

缺点:

1、Redis 不好啊在线扩容的,集群容量一旦到达上限,在线扩容就十分麻烦!
2、实现哨兵模式的配置其实是很麻烦的,里面有很多选择!

Redis Cluster(针对于redis5以上版本)

1,复制redis.conf至少5份 端口号分别为6380,6381,6382,7001,7002
2,在各个redist.conf修改端口号及开启cluster设置
port 端口号
cluster-enabled yes
cluster-config-file nodes-端口号.conf
cluster-node-timeout 15000
appendonly yes
3,redis-server 启动每个端口
3,创建redis cluster

[root@iZ2zeh3bjq6rgnw0phucy7Z /]# redis-cli --cluster create 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 1(创建集群命令)
 
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 127.0.0.1:6382 to 127.0.0.1:6379
Adding replica 127.0.0.1:7001 to 127.0.0.1:6380
Adding replica 127.0.0.1:7002 to 127.0.0.1:6381
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 6a5450518ef379395f6fb9bcf4ab8791a65526df 127.0.0.1:6379
   slots:[0-5460] (5461 slots) master
M: ba131e967f68b46437acfb6d045cf6884eb69679 127.0.0.1:6380
   slots:[5461-10922] (5462 slots) master
M: 116dd664690c3a9f211be5855e1aa30cf3164a7c 127.0.0.1:6381
   slots:[10923-16383] (5461 slots) master
S: 200f18ce064fe20b8076f198517a5eb0c4f0ad91 127.0.0.1:6382
   replicates ba131e967f68b46437acfb6d045cf6884eb69679
S: f02ac254631bf93e558c58532da68812e0420a15 127.0.0.1:7001
   replicates 116dd664690c3a9f211be5855e1aa30cf3164a7c
S: a15a960026b8f3261bee688a9f7ff6dea26e494f 127.0.0.1:7002
   replicates 6a5450518ef379395f6fb9bcf4ab8791a65526df
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 127.0.0.1:6379)
M: 6a5450518ef379395f6fb9bcf4ab8791a65526df 127.0.0.1:6379
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: f02ac254631bf93e558c58532da68812e0420a15 127.0.0.1:7001
   slots: (0 slots) slave
   replicates 116dd664690c3a9f211be5855e1aa30cf3164a7c
M: ba131e967f68b46437acfb6d045cf6884eb69679 127.0.0.1:6380
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: a15a960026b8f3261bee688a9f7ff6dea26e494f 127.0.0.1:7002
   slots: (0 slots) slave
   replicates 6a5450518ef379395f6fb9bcf4ab8791a65526df
M: 116dd664690c3a9f211be5855e1aa30cf3164a7c 127.0.0.1:6381
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: 200f18ce064fe20b8076f198517a5eb0c4f0ad91 127.0.0.1:6382
   slots: (0 slots) slave
   replicates ba131e967f68b46437acfb6d045cf6884eb69679
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.(代表集群建立成功)

查看redis cluster状态
[root@iZ2zeh3bjq6rgnw0phucy7Z /]# redis-cli
127.0.0.1:6379> cluster info
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集群中master个数
cluster_current_epoch:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:30
cluster_stats_messages_pong_sent:30
cluster_stats_messages_sent:60
cluster_stats_messages_ping_received:25
cluster_stats_messages_pong_received:30
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:60
127.0.0.1:6379> 

添加新节点

新增reidsxxx.conf修改端口并运行

redis-cli --cluster add-node 127.0.0.1:7004 127.0.0.1:6379

>>> Adding node 127.0.0.1:7004 to cluster 127.0.0.1:6379
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: 6a5450518ef379395f6fb9bcf4ab8791a65526df 127.0.0.1:6379
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: f02ac254631bf93e558c58532da68812e0420a15 127.0.0.1:7001
   slots: (0 slots) slave
   replicates 116dd664690c3a9f211be5855e1aa30cf3164a7c
M: ba131e967f68b46437acfb6d045cf6884eb69679 127.0.0.1:6380
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: a15a960026b8f3261bee688a9f7ff6dea26e494f 127.0.0.1:7002
   slots: (0 slots) slave
   replicates 6a5450518ef379395f6fb9bcf4ab8791a65526df
M: 116dd664690c3a9f211be5855e1aa30cf3164a7c 127.0.0.1:6381
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: 200f18ce064fe20b8076f198517a5eb0c4f0ad91 127.0.0.1:6382
   slots: (0 slots) slave
   replicates ba131e967f68b46437acfb6d045cf6884eb69679
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Send CLUSTER MEET to node 127.0.0.1:7004 to make it join the cluster.
[OK] New node added correctly.

新节点分配槽
	第一步:连接上集群(连接集群中任意一个可用结点都行)
		./redis-cli --cluster reshard 192.168.127.128:5561
		
	第二步:输入要分配的槽数量
		How many slots do you want to move (from 1 to 16384)? 3000
		输入:3000,表示要给目标节点分配3000个槽


	第三步:输入接收槽的结点id
		What is the receiving node ID?
		输入:50b073163bc4058e89d285dc5dfc42a0d1a222f2
		PS:这里准备给7007分配槽,通过cluster nodes查看7007结点id为:
				50b073163bc4058e89d285dc5dfc42a0d1a222f2


	第四步:输入源结点id
		Please enter all the source node IDs.
		Type 'all' to use all the nodes as source nodes for the hash slots.
		Type 'done' once you entered all the source nodes IDs.


	第五步:输入yes开始移动槽到目标结点id
		输入:yes


root@iZ2zeh3bjq6rgnw0phucy7Z /]# redis-cli --cluster reshard 127.0.0.1:6379
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: 4f4420e9b264580ce7f578ce8392e7c4d8e4e379 127.0.0.1:6379
   slots:[835-5460] (4626 slots) master
   1 additional replica(s)
S: 69ebd5a03ff9ace090d5d3a91e899f822892f351 127.0.0.1:7005
   slots: (0 slots) slave
   replicates 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
M: 63a36660b9bf6892509ed514abbd271ca381fe0e 127.0.0.1:7006
   slots: (0 slots) master
S: 7d651f8513f4db9e867fffa12aae8bd57b2aff2f 127.0.0.1:6382
   slots: (0 slots) slave
   replicates 908c3c597a506d4e878ff0f97171086e6586d9df
M: 45dd084e870ff9c50e4c4aad2266931e54dd1fc9 127.0.0.1:6380
   slots:[6296-10922] (4627 slots) master
   1 additional replica(s)
M: 7e5d45b4debd096f6cfd0ac9f995374704cc2afc 127.0.0.1:7004
   slots:[0-834],[5461-6295],[10923-11756] (2504 slots) master
   2 additional replica(s)
S: e6ef3550b0751f28159e87d889499b1009f01c10 127.0.0.1:7001
   slots: (0 slots) slave
   replicates 4f4420e9b264580ce7f578ce8392e7c4d8e4e379
S: b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54 127.0.0.1:7003
   slots: (0 slots) slave
   replicates 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
M: 908c3c597a506d4e878ff0f97171086e6586d9df 127.0.0.1:6381
   slots:[11757-16383] (4627 slots) master
   1 additional replica(s)
S: 3be1267f8e11cc015b5378e28715dc5ac04876c9 127.0.0.1:7002
   slots: (0 slots) slave
   replicates 45dd084e870ff9c50e4c4aad2266931e54dd1fc9
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
How many slots do you want to move (from 1 to 16384)? 500(分配槽点)
What is the receiving node ID? 7e5d45b4debd096f6cfd0ac9f995374704cc2afc(要分配节点ID)
Please enter all the source node IDs.
  Type 'all' to use all the nodes as source nodes for the hash slots.
  Type 'done' once you entered all the source nodes IDs.
Source node #1: all(全部节点)
.
.
.
    Moving slot 95 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 96 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 97 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 98 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 99 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 100 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 101 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 102 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 103 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 104 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
    Moving slot 105 from 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
Do you want to proceed with the proposed reshard plan (yes/no)? yes(输入yes)
.
.
.
.
.
Moving slot 100 from 127.0.0.1:7004 to 127.0.0.1:6381: 
Moving slot 101 from 127.0.0.1:7004 to 127.0.0.1:6381: 
Moving slot 102 from 127.0.0.1:7004 to 127.0.0.1:6381: 
Moving slot 103 from 127.0.0.1:7004 to 127.0.0.1:6381: 
Moving slot 104 from 127.0.0.1:7004 to 127.0.0.1:6381: 
Moving slot 105 from 127.0.0.1:7004 to 127.0.0.1:6381: 
(槽点分配成功)

添加新节点作为副本
redis-cli --cluster add-node 127.0.0.1:7006 127.0.0.1:7000 --cluster-slave
[root@iZ2zeh3bjq6rgnw0phucy7Z /]# redis-cli --cluster add-node 127.0.0.1:7005(新节点) 127.0.0.1:7004 --cluster-slave --cluster-master-id (主节点id)7e5d45b4debd096f6cfd0ac9f995374704cc2afc
>>> Adding node 127.0.0.1:7005 to cluster 127.0.0.1:7004
>>> Performing Cluster Check (using node 127.0.0.1:7004)
M: 7e5d45b4debd096f6cfd0ac9f995374704cc2afc 127.0.0.1:7004
   slots:[0-834],[5461-6295],[10923-11756] (2504 slots) master
   1 additional replica(s)
M: 45dd084e870ff9c50e4c4aad2266931e54dd1fc9 127.0.0.1:6380
   slots:[6296-10922] (4627 slots) master
   1 additional replica(s)
S: 3be1267f8e11cc015b5378e28715dc5ac04876c9 127.0.0.1:7002
   slots: (0 slots) slave
   replicates 45dd084e870ff9c50e4c4aad2266931e54dd1fc9
M: 908c3c597a506d4e878ff0f97171086e6586d9df 127.0.0.1:6381
   slots:[11757-16383] (4627 slots) master
   1 additional replica(s)
S: 7d651f8513f4db9e867fffa12aae8bd57b2aff2f 127.0.0.1:6382
   slots: (0 slots) slave
   replicates 908c3c597a506d4e878ff0f97171086e6586d9df
S: e6ef3550b0751f28159e87d889499b1009f01c10 127.0.0.1:7001
   slots: (0 slots) slave
   replicates 4f4420e9b264580ce7f578ce8392e7c4d8e4e379
S: b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54 127.0.0.1:7003
   slots: (0 slots) slave
   replicates 7e5d45b4debd096f6cfd0ac9f995374704cc2afc
M: 4f4420e9b264580ce7f578ce8392e7c4d8e4e379 127.0.0.1:6379
   slots:[835-5460] (4626 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.
>>> Send CLUSTER MEET to node 127.0.0.1:7005 to make it join the cluster.
Waiting for the cluster to join

>>> Configure node as replica of 127.0.0.1:7004.
[OK] New node added correctly.(成功)
获取主从关系
redis-cli -h 127.0.0.1 -p 6379 -c cluster slots | xargs  -n8 | awk '{print $3":"$4"->"$6":"$7}' | sort -nk2 -t ':' | uniq


[root@iZ2zeh3bjq6rgnw0phucy7Z /]# redis-cli -h 127.0.0.1 -p 6379 -c cluster slots | xargs  -n8 | awk '{print $3":"$4"->"$6":"$7}' | sort -nk2 -t ':' | uniq
:->:
1030:127.0.0.1->908c3c597a506d4e878ff0f97171086e6586d9df:127.0.0.1
105:127.0.0.1->908c3c597a506d4e878ff0f97171086e6586d9df:127.0.0.1
16383:127.0.0.1->908c3c597a506d4e878ff0f97171086e6586d9df:127.0.0.1
6492:127.0.0.1->908c3c597a506d4e878ff0f97171086e6586d9df:127.0.0.1
7e5d45b4debd096f6cfd0ac9f995374704cc2afc:127.0.0.1->b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54:127.0.0.1
b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54:127.0.0.1->69ebd5a03ff9ace090d5d3a91e899f822892f351:10923
69ebd5a03ff9ace090d5d3a91e899f822892f351:5461->127.0.0.1:7004
127.0.0.1:6379->127.0.0.1:7001
127.0.0.1:6380->127.0.0.1:7002
127.0.0.1:7004->127.0.0.1:7003

CLUSTER SLOTS命令返回哈希槽和Redis实例映射关系。这个命令对客户端实现集群功能非常有用,使用这个命令可以获得哈希槽与节点(由IP和端口组成)的映射关系,这样,当客户端收到(用户的)调用命令时,可以根据(这个命令)返回的信息将命令发送到正确的Redis实例

127.0.0.1:6379> cluster slots
1) 1) (integer) 1031
   2) (integer) 5460
   3) 1) "127.0.0.1"
      2) (integer) 6379
      3) "4f4420e9b264580ce7f578ce8392e7c4d8e4e379"
   4) 1) "127.0.0.1"
      2) (integer) 7001
      3) "e6ef3550b0751f28159e87d889499b1009f01c10"
2) 1) (integer) 6493
   2) (integer) 10922
   3) 1) "127.0.0.1"
      2) (integer) 6380
      3) "45dd084e870ff9c50e4c4aad2266931e54dd1fc9"
   4) 1) "127.0.0.1"
      2) (integer) 7002
      3) "3be1267f8e11cc015b5378e28715dc5ac04876c9"
3) 1) (integer) 106
   2) (integer) 834
   3) 1) "127.0.0.1"
      2) (integer) 7004
      3) "7e5d45b4debd096f6cfd0ac9f995374704cc2afc"
   4) 1) "127.0.0.1"
      2) (integer) 7003
      3) "b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54"
   5) 1) "127.0.0.1"
      2) (integer) 7005
      3) "69ebd5a03ff9ace090d5d3a91e899f822892f351"
4) 1) (integer) 5461
   2) (integer) 6295
   3) 1) "127.0.0.1"
      2) (integer) 7004
      3) "7e5d45b4debd096f6cfd0ac9f995374704cc2afc"
   4) 1) "127.0.0.1"
      2) (integer) 7003
      3) "b47ab21424f64f7ffb5ab4a8dd5994418b0f3c54"
   5) 1) "127.0.0.1"
      2) (integer) 7005

报错1:
[ERR] Node 127.0.0.1:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
解决办法:删除nodes-xxx.conf配置文件,删除pid文件,删除各节点aof,rdb文件,杀掉所有redis进程,然后重启redis集群搞定

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值