Replication
FrogDB supports primary-replica replication using an orchestrated model (not gossip). Standard Redis replication commands (REPLICAOF, ROLE, INFO replication) work as expected — see Redis replication docs.
How FrogDB Differs from Redis Replication
Section titled “How FrogDB Differs from Redis Replication”- Orchestrated failover — an external orchestrator manages topology, not Sentinel or gossip
- RocksDB checkpoints for full resync instead of RDB transfer
- SHA256 integrity verification during checkpoint streaming
- Replicas do not evict independently — all eviction decisions come from the primary via replicated DEL commands
- Memory-aware sync — replicas monitor memory during full sync and can pause/abort if limits are exceeded
Configuration
Section titled “Configuration”[replication]role = "replica" # standalone, primary, replicaprimary-host = "primary.example.com"primary-port = 6379min-replicas-to-write = 1 # Write quorum (0 = disabled)min-replicas-timeout-ms = 5000WAL Retention
Section titled “WAL Retention”WAL retention determines how long replicas can be disconnected before requiring full resync:
[rocksdb]min-wal-retention-secs = 3600 # Keep WAL for 1 hourmin-wal-files-to-keep = 10Increase if replicas may be offline for extended periods.
Replication ID
Section titled “Replication ID”Each dataset history has a unique replication ID. On failover:
- Promoted replica generates a new replication ID
- Promoted replica remembers the old primary’s ID (secondary ID)
- Other replicas can continue with partial sync using either ID
Failover
Section titled “Failover”Managed by the external orchestrator:
- Orchestrator detects primary failure via health checks
- Orchestrator selects a replica for promotion
- Promoted replica generates new replication ID, begins accepting writes
- Other replicas reconnect to new primary (PSYNC using secondary ID)
- Clients receive
-MOVEDredirections
Memory Considerations
Section titled “Memory Considerations”- Provision replicas with 10-20% more memory than the primary (replication buffers)
- When a promoted replica becomes primary,
maxmemorybecomes active and eviction begins immediately if over limit - Full sync memory is configurable:
[replication]fullsync-max-memory-mb = 512 # Max memory for full sync bufferingMonitoring
Section titled “Monitoring”INFO replicationCompare master_repl_offset (primary) with slave_repl_offset (replica) to measure lag.
| Symptom | Likely Cause | Fix |
|---|---|---|
| Frequent full resyncs | WAL retention too short | Increase min-wal-retention-secs |
| Replica OOM during sync | Primary dataset exceeds replica memory | Increase replica memory |