pub struct ClusterSection {
pub enabled: bool,
pub port_base: u16,
pub node_id: String,
pub elect_port_base: u16,
pub peers: Vec<PeerEntry>,
pub scopes: Vec<ScopeEntry>,
}Expand description
[cluster] section — single-node cluster mode: keys route by
Redis-cluster slot (CRC16 {hashtag} & 16383) and every shard i
gets a second, deterministic listener at port_base + i that answers
wrong-shard keys with -MOVED, so stock cluster-aware clients
(redis-benchmark --cluster, redis-cli -c) can address shards
directly. The main SO_REUSEPORT port keeps full forward-anywhere
behaviour for non-cluster clients. Not hot-settable: the routing
scheme is a startup property of the data dir (shards.meta).
The struct is Clone but not Copy (since peers and scopes
hold owned vectors). Most call sites just clone the per-tick
Config snapshot via Arc<Config>, so this is invisible in the
hot path.
Fields§
§enabled: boolEnable cluster mode. Default false (zero change).
port_base: u16First cluster port (shard i listens at port_base + i).
0 (default) = server.port + 1.
node_id: StringThis node’s stable id for the quorum election (≤ 32 B
ASCII; unique across the cluster). Default empty —
kevy-elect is dormant unless both node_id and peers
are set, so existing configs need no edit.
elect_port_base: u16First election-control listener port; shard i binds at
elect_port_base + i. Default 0 → server.port + 200
(locked by the resolved_elect_port_base unit test).
peers: Vec<PeerEntry>Operator-declared peer list for kevy-elect. Empty when
failover is not configured. Each entry is one cluster node
(including potentially this node — kevy-elect filters
self by matching node_id).
scopes: Vec<ScopeEntry>Scope declarations: each entry pins a key prefix to a writer
node (and optional fallback). Empty when scope-based
multi-writer is off. Same flat-string TOML shape as peers
— scopes = "prefix=writer[|fallback],...".
Trait Implementations§
Source§impl Clone for ClusterSection
impl Clone for ClusterSection
Source§fn clone(&self) -> ClusterSection
fn clone(&self) -> ClusterSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more