-
In my use case, there is some work that should only be done once and the result would be propagated to other nodes. How can I make sure that only one node does this work? I am thinking of having the leader to do it, but I dont see any doc on determining whether a raft node is the leader. Any suggestions? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
If you are using raft package, |
Beta Was this translation helpful? Give feedback.
-
There is an example in the benchmark. Hope it helps you. etcd/tools/benchmark/cmd/util.go Lines 43 to 67 in 4977877 |
Beta Was this translation helpful? Give feedback.
If you are using raft package,
Node.Status().RaftState.RaftState == StateLeader
is your choice .