How to manage list of currently active raft-nodes? #1399
-
I am building system that requires to understand which nodes of Raft-cluster is currently down. It doesn't mean I want to remove unreachable nodes from membership, I just want to have some state which will have a list of currently active nodes. It is appropriate that "unreachable" actually would mean "unreachable from leader node" or something like that. How may I implement this state? I didn't find any callbacks in processing and also didn't find a way to access |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Get With OpenRaft 0.9: If With OpenRaft 0.10, there is another way: openraft/openraft/src/metrics/raft_metrics.rs Lines 107 to 108 in 8cbc7c2
|
Beta Was this translation helpful? Give feedback.
Get
RaftMetrics
viaRaft::metrics()
on the leader node.With OpenRaft 0.9:
In
RaftMetrics
:https://docs.rs/openraft/0.9.21/openraft/metrics/struct.RaftMetrics.html
If
pub replication: Option<BTreeMap<NID, Option<LogId<NID>>>>
lags significantly behindpub last_log_index: Option<u64>
, it means replication to this node has issues and the node may be down.With OpenRaft 0.10, there is another way:
In
RaftMetrics
:openraft/openraft/src/metrics/raft_metrics.rs
Lines 107 to 108 in 8cbc7c2
type HeartbeatMetrics = BTreeMap<NodeIdOf<C>, Option<SerdeInstantOf<C>>>
stores the timestamp of the last acknowledgment from a node. If this…