redis集群的一些笔记
当节点数量少于6个时候会提示如下信息,初始化一个集群的时候需要6个节点,为什么??
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 4 nodes and 1 replicas per node.
*** At least 6 nodes are required.
从下面的信息可以看出,每一个master节点都有一个slave节点
Using 3 masters:
127.0.0.1:7000
127.0.0.1:7001
127.0.0.1:7002
Adding replica 127.0.0.1:7003 to 127.0.0.1:7000
Adding replica 127.0.0.1:7004 to 127.0.0.1:7001
Adding replica 127.0.0.1:7005 to 127.0.0.1:7002
M: 52a024cde6320e82d4db950b4682fad8b40d5daa 127.0.0.1:7000
slots:0-5460 (5461 slots) master
M: e7dfccc77c8878a746e03af9c3c56ec0ec96e9c2 127.0.0.1:7001
slots:5461-10922 (5462 slots) master
M: 24ab83a8114132e0fc7114b7bb326eec4a48c337 127.0.0.1:7002
slots:10923-16383 (5461 slots) master
S: c896154507aa7308606a6f512b81ccb1e436e285 127.0.0.1:7003
replicates 52a024cde6320e82d4db950b4682fad8b40d5daa
S: b8fdbe194a119f1a130bd7d76577746c4f7293e3 127.0.0.1:7004
replicates e7dfccc77c8878a746e03af9c3c56ec0ec96e9c2
S: 33f5e4903d18387cb4dc20dc6bdb0d4e6b481b8e 127.0.0.1:7005
replicates 24ab83a8114132e0fc7114b7bb326eec4a48c337
分配不同的epoch给节点有什么用??
Assign a different config epoch to each node
33:M 21 Sep 00:06:43.629 # configEpoch set to 1 via CLUSTER SET-CONFIG-EPOCH
24:M 21 Sep 00:06:43.630 # configEpoch set to 2 via CLUSTER SET-CONFIG-EPOCH
37:M 21 Sep 00:06:43.630 # configEpoch set to 3 via CLUSTER SET-CONFIG-EPOCH
48:M 21 Sep 00:06:43.631 # configEpoch set to 4 via CLUSTER SET-CONFIG-EPOCH
63:M 21 Sep 00:06:43.631 # configEpoch set to 5 via CLUSTER SET-CONFIG-EPOCH
67:M 21 Sep 00:06:43.632 # configEpoch set to 6 via CLUSTER SET-CONFIG-EPOCH
假设我的数据存储在127.0.0.1:7002的节点里面,他的slave节点为127.0.0.1:7004,当两个节点都挂掉以后,数据是否会丢失??
当集群有一个master进入fail状态,并且这个master节点没有slave,则集群进入fail状态