Raft::Config
Configuration parameters for a Raft node.
All timeout values are in milliseconds. Sensible defaults are provided for production use. For testing, use shorter timeouts (e.g., 50-100ms election timeout, 25ms heartbeat).
Constructors
Creates a Config with all fields set to their defaults.
All parameters are keyword arguments matching the property names.
Defaults are appropriate for local clusters; adjust timeouts based on
your network RTT (or enable rtt_tuning for automatic tuning).
Instance methods
Enable active-passive mode for 2-node clusters. Lowers quorum to 1 so either node can elect itself and accept writes when the other is down.
WARNING: This sacrifices consistency for availability. During a network partition both nodes may accept writes independently. When the partition heals, the node with the lower term loses its divergent entries via normal Raft log conflict resolution. Only use when availability is more important than strict consistency.
Pre-shared key for HMAC-SHA256 connection authentication.
Used by Transport::TCP and Transport::Handshake.
Pre-shared key for HMAC-SHA256 connection authentication.
Used by Transport::TCP and Transport::Handshake.
Minimum election timeout in milliseconds. A follower that receives no
heartbeat within a random duration between this and election_timeout_max
will start a pre-vote round.
Minimum election timeout in milliseconds. A follower that receives no
heartbeat within a random duration between this and election_timeout_max
will start a pre-vote round.
Heartbeat interval in milliseconds. The leader sends heartbeats to followers at this interval to maintain authority. Should be significantly less than the election timeout.
Heartbeat interval in milliseconds. The leader sends heartbeats to followers at this interval to maintain authority. Should be significantly less than the election timeout.
Maximum number of log entries to include in a single AppendEntries RPC.
Maximum number of in-flight AppendEntries RPCs per replicator (pipeline depth).
Higher values improve throughput when network RTT is the bottleneck by overlapping
consecutive batches. Set to 1 to disable pipelining and match pre-pipeline behaviour.
Maximum number of in-flight AppendEntries RPCs per replicator (pipeline depth).
Higher values improve throughput when network RTT is the bottleneck by overlapping
consecutive batches. Set to 1 to disable pipelining and match pre-pipeline behaviour.
Interval in seconds between RTT measurement probes. Default: 60.
Enable automatic RTT-based timeout tuning. When enabled, the node periodically measures round-trip time to peers and adjusts heartbeat and election timeouts following etcd best practices.
Maximum size in bytes of each snapshot chunk sent via InstallSnapshot RPC.
Maximum size in bytes of each snapshot chunk sent via InstallSnapshot RPC.
Number of applied entries since the last snapshot before automatically triggering a new snapshot. Set to 0 to disable auto-snapshots.