mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
redis-trib create: use CONFIG SET-CONFIG-EPOCH before joining the cluster.
This way there is no need for the conflict resolution algo to be used in order to start with a cluster where each node has a different configEpoch.
This commit is contained in:
parent
63d1f9e570
commit
658ad301cc
@ -609,6 +609,22 @@ class RedisTrib
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Redis Cluster config epoch collision resolution code is able to eventually
|
||||||
|
# set a different epoch to each node after a new cluster is created, but
|
||||||
|
# it is slow compared to assign a progressive config epoch to each node
|
||||||
|
# before joining the cluster. However we do just a best-effort try here
|
||||||
|
# since if we fail is not a problem.
|
||||||
|
def assign_config_epoch
|
||||||
|
config_epoch = 1
|
||||||
|
@nodes.each{|n|
|
||||||
|
begin
|
||||||
|
n.r.cluster("set-config-epoch",config_epoch)
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
config_epoch += 1
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def join_cluster
|
def join_cluster
|
||||||
# We use a brute force approach to make sure the node will meet
|
# We use a brute force approach to make sure the node will meet
|
||||||
# each other, that is, sending CLUSTER MEET messages to all the nodes
|
# each other, that is, sending CLUSTER MEET messages to all the nodes
|
||||||
@ -850,6 +866,8 @@ class RedisTrib
|
|||||||
yes_or_die "Can I set the above configuration?"
|
yes_or_die "Can I set the above configuration?"
|
||||||
flush_nodes_config
|
flush_nodes_config
|
||||||
xputs ">>> Nodes configuration updated"
|
xputs ">>> Nodes configuration updated"
|
||||||
|
xputs ">>> Assign a different config epoch to each node"
|
||||||
|
assign_config_epoch
|
||||||
xputs ">>> Sending CLUSTER MEET messages to join the cluster"
|
xputs ">>> Sending CLUSTER MEET messages to join the cluster"
|
||||||
join_cluster
|
join_cluster
|
||||||
# Give one second for the join to start, in order to avoid that
|
# Give one second for the join to start, in order to avoid that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user