pub struct ReplicationSection {
pub role: ReplicationRole,
pub upstream: Option<String>,
pub listen_port_base: u16,
pub replication_buffer_size: u64,
pub reconnect_window_ms: u32,
pub min_replicas_to_write: u32,
pub min_replicas_max_lag_ms: u32,
pub replica_max_staleness_ms: u32,
pub replica_read_only: bool,
pub single_source: bool,
}Expand description
[replication] section — primary/replica streaming replication.
When role = "standalone" (default) this whole subsystem is
dormant: no listener, no upstream connection, no buffer
allocated. role = "primary" brings up a TCP listener on
listen_port that streams every applied mutation to connected
replicas. role = "replica" connects to upstream, full-syncs
from a snapshot, then applies live frames.
Quorum failover is configured separately via the [cluster]
node_id + peers keys; see crate::cluster::ClusterSection.
Fields§
§role: ReplicationRoleNode role. Standalone (default) disables the whole subsystem.
upstream: Option<String>host:port of the primary, for role = "replica". Ignored when
role != "replica". None for replica = config-error at startup.
listen_port_base: u16TCP port BASE the primary listens on for incoming replica
connections — shard i binds at listen_port_base + i, mirroring
the cluster listener pattern. 0 (default) = server.port + 10000 as the base, picked at startup. Only meaningful when
role = "primary". Replicas use a shard-aware client that
connects to all nshards ports to mirror the full keyspace.
replication_buffer_size: u64Bounded ring buffer for recent applied frames (bytes). A replica
that disconnects and reconnects within this backlog window catches
up without a full snapshot. Default 256mb.
reconnect_window_ms: u32How long the primary keeps a disconnected replica’s slot before
dropping it (and forcing a full snapshot on reconnect). Default
60_000 (60 s).
min_replicas_to_write: u32v3.14 D5 — primary refuses writes when fewer than this many
replicas have a live ACK within min_replicas_max_lag_ms.
0 (default) disables the check. A lag heuristic, not a
quorum guarantee — the quorum lease (v3.16) is the real
split-brain fence.
min_replicas_max_lag_ms: u32Freshness window for min_replicas_to_write (ms).
replica_max_staleness_ms: u32v3.16 D3 — bounded staleness: a replica whose last primary
heartbeat is older than this refuses reads with -STALE
(client falls back to the primary). 0 = off (default:
reads always answer, whatever the lag).
replica_read_only: boolv3.14 — reject client writes while in the replica role
(-READONLY). Default true, Redis-compatible; the
replication apply path and admin verbs bypass the gate.
single_source: boolv3.2 — the upstream is a SINGLE stream on one port (an embedded
writer’s embed_writer_listen_addr source) rather than a
per-shard port fleet: one routing runner fans frames into local
shards by key hash. Only meaningful when role = "replica".
Trait Implementations§
Source§impl Clone for ReplicationSection
impl Clone for ReplicationSection
Source§fn clone(&self) -> ReplicationSection
fn clone(&self) -> ReplicationSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more