CLUSTER BUMPEPOCH
Available since: 3.0.0
Time complexity: O(1)
ACL categories: @admin @slow @dangerous
Advances the cluster config epoch.
提升集群的config epoch(纪元)
The CLUSTER BUMPEPOCH command triggers an increment to the cluster’s config epoch from the connected node. The epoch will be incremented if the node’s config epoch is zero, or if it is less than the cluster’s greatest epoch.
CLUSTER BUMPEPOCH
命令会触发提高客户端连接的节点纪元的操作。如果节点的纪元值小于集群最大的纪元值(current_epoch),或者当前节点纪元值为0,则当前节点的纪元值就会提高
Note: config epoch management is performed internally by the cluster, and relies on obtaining a consensus of nodes. The CLUSTER BUMPEPOCH attempts to increment the config epoch WITHOUT getting the consensus, so using it may violate the “last failover wins” rule. Use it with caution.
注意:纪元值管理由集群内部执行,并依赖于获得节点一致性。
CLUSTER BUMPEPOCH
命令会在没有获得一致意见的情况下增加纪元值,因此使用它可能违反“上次故障切换获胜”规则。小心使用。
Return
Simple string reply: BUMPED if the epoch was incremented, or STILL if the node already has the greatest config epoch in the cluster.
返回值:
纪元值提升返回BUMPED
节点纪元值已经是集群最高则返回 STILL
#执行前
[~]$ redis-cli -h 10.4.173.43 -p 8014 cluster info
cluster_current_epoch:7
cluster_my_epoch:3
#执行后
[~]$ redis-cli -h 10.4.173.43 -p 8014 cluster bumpepoch
BUMPED 8
[~]$ redis-cli -h 10.4.173.43 -p 8014 cluster info
cluster_state:ok
cluster_current_epoch:8
cluster_my_epoch:8
[~]$ redis-cli -h 10.4.173.43 -p 8014 cluster nodes
d9b92ca2f5a100eddba210fd2bc17d2e5d86850f 10.4.173.46:8014 master - 0 1648866882806 6 connected 0-5461
262b44aeedad82b0b0b643b6c1fdd58adff95213 10.4.173.43:8014 myself,master - 0 0 8 connected 10924-16383
552abf070c951751d64efe9ebc207c572d8d042a 10.4.176.44:8014 slave d9b92ca2f5a100eddba210fd2bc17d2e5d86850f 0 1648866881804 6 connected
ed5f2b262beb48cb10951f12a494caac2bfb5d5f 10.4.173.45:8014 slave d7bc4908cd3a0c819e80f40a768b8fc7b16220d6 0 1648866880803 4 connected
d2d387ea1bd2fc6fd4b400018fca1733ccc99e2b 10.4.173.49:8014 slave 262b44aeedad82b0b0b643b6c1fdd58adff95213 0 1648866883807 8 connected
d7bc4908cd3a0c819e80f40a768b8fc7b16220d6 10.4.173.44:8014 master - 0 1648866879800 4 connected 5462-10923
经测试,该命令执行以后,会将当前节点的纪元值设置为当前集群最大纪元值(current_epoch)+1,如当前节点纪元值为3,当前集群最大纪元值为7 ,执行该命令以后,当前节点纪元值和集群最大的纪元值都变为8。