The administrative plane of Slyber DB is built for zero-downtime maintenance across standalone servers and Multi-Raft clusters: secret rotation, node draining, partition rebalancing, and consistent hot backups all execute under live traffic.
1. Admin HTTPS API Reference (:9095)
All administrative endpoints (except /healthz) operate strictly over TLS 1.3, require Authorization: Bearer <AdminSecret>, and enforce strict JSON decoding (unknown fields return 400 Bad Request). After 10 failed authentication attempts within 1 minute, the source IP is automatically banned for 5 minutes.
| Method & Path | Auth | Purpose |
|---|---|---|
GET /healthz | None | Node readiness status: 200 {"ok":true} or 503 {"ok":false} when draining or shutting down |
GET /metrics | Bearer | Node metrics in Prometheus v0.0.4 text exposition format |
GET /v1/admin/stats | Bearer | Detailed JSON telemetry for the node and every local shard (db.NodeStats) |
POST /v1/admin/topology | Bearer | Bootstrap or update cluster topology (epoch must strictly increase, else 409 Conflict) |
POST /v1/admin/secrets | Bearer | Hot-rotate secrets without restarting or dropping active client sessions |
POST /v1/admin/drain | Bearer | Toggle draining mode and step down Multi-Raft leaders |
POST /v1/admin/backup | Bearer | Create an instant hot snapshot in the target directory |
POST /v1/admin/migrate | Bearer | Run online migration of a virtual partition between replica groups (ModeCluster) |
2. Zero-Downtime Secret Rotation (POST /v1/admin/secrets)
To rotate ClientSecret, ClusterSecret, or AdminSecret without client errors:
- Generate the new secret and push it to
/v1/admin/secretswhile keeping the previous secret infallback_*_secrets:
curl -sk -X POST "https://10.0.1.11:9095/v1/admin/secrets" \
-H "Authorization: Bearer ${OLD_ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"client_secret": "new_client_secret_99887766554433221100aabbccdd",
"fallback_client_secrets": ["old_client_secret_11223344556677889900ffeeddcc"]
}'
- Roll out the new secret to client applications (during the transition window, the node verifies both secrets in constant time).
- Persist the new secret file on disk (or in
.env) for future restarts, then call/v1/admin/secretswith"fallback_client_secrets": []to revoke the old key.
3. Graceful Node Maintenance (Draining)
Before upgrading binaries or rebooting a host, place the node into draining mode:
curl -sk -X POST "https://10.0.1.12:9095/v1/admin/drain" \
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"draining": true}'
Activating drain immediately switches /healthz on ports :9110 and :9095 to 503 Service Unavailable for load balancers and invokes StepDownAll() to transfer Multi-Raft leadership to peer nodes without election timeouts. Once in-flight requests finish, send SIGTERM to stop the process cleanly.
4. Online Partition Migration (POST /v1/admin/migrate)
In ModeCluster, any virtual partition partID can be moved to another replica group target_group_id that satisfies the shard alignment invariant (partID & shardMask) == (targetGroupID & shardMask). Send the request to the current leader of the source group:
curl -sk -X POST "https://10.0.1.11:9095/v1/admin/migrate" \
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"partition_id": 256,
"target_group_id": 16,
"target_node_id": 3,
"new_epoch": 2
}'
Migration executes in two stages:
- Background pre-copy (Stage 1): streams a full
PEX2snapshot into the target group without blocking writes on the source. - Barrier and atomic cutover (Stage 2): briefly pauses writes only for partition
256(the remaining 4095 partitions stay unaffected), establishes a Raft barrier, transfers the final delta (including counters, cursors, deduplication rings, and active 2PC locks), commits the newTOPOLOGY.bin, and redirects clients seamlessly viaErrPartitionMoved.
5. Hot Backups and Recovery
Hot backups run without pausing reads or writes: active MemTables flush to immutable .sst files, .vlog and .slog/.sidx segments rotate, and files are hard-linked into the destination via os.Link (automatically falling back to streaming copy across mount points) alongside a MANIFEST.sha256 verification file:
curl -sk -X POST "https://10.0.1.11:9095/v1/admin/backup" \
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"dest_dir": "/var/backups/sldb/snap_2026_11_30"}'
(cd /var/backups/sldb/snap_2026_11_30 && sha256sum -c MANIFEST.sha256)
- Restoring Embedded / Standalone: stop the process, copy the backup directory into
--data-dir(using the same--shardsand--encryption-key-file), and start the server. - Restoring ModeCluster: every backup directory is self-contained with
IDENTITY,TOPOLOGY.bin, and exactSysSubRaftAppliedstate. For full-cluster restore, copy each node's snapshot into its--data-dirand restart. To replace a single lost node while quorum remains intact, no backup is required—boot a clean node with the same--node-idand post the current/v1/admin/topologyso the leader catches it up viaInstallSnapshot.
6. Recovering from Disk Full (ErrDiskFull)
When free space drops below DiskFreeMinBytes or DiskFreeMinPercent:
NodeStats.DiskCircuitOpenturnstrue,db_disk_full_rejects_totalincrements, and growth writes (Put,CAS,AddInt64,AppendStream,PatchStream) returndb.ErrDiskFull(507 Insufficient Storageon Admin API).- Reads and space-reclaiming operations remain fully operational.
- Run
Delete,DeleteRange,DeletePrefix,DropNamespace,TrimStream, orDeleteStream: background LSM compaction and VLog GC borrow space fromreserve.ballast, rewrite live records, delete obsolete segments, and automatically restorereserve.ballastand reopen writes once free disk space recovers—without restarting the node.
7. Key Prometheus Metrics (GET /metrics)
| Metric | Type | Description & Alerting Guidance |
|---|---|---|
db_corruption_errors_total | counter | CRC32C checksum or AES-GCM authentication tag errors (critical alert when > 0) |
db_disk_full_rejects_total | counter | Writes rejected by the disk free-space circuit breaker |
db_disk_free_bytes / db_ballast_bytes | gauge | Available filesystem bytes and current reserve.ballast size |
db_raft_replica_lag_entries | gauge | Maximum follower log lag in entries across local leader groups |
db_clock_skew_errors_total | counter | Packets rejected due to NTP clock drift exceeding MaxClockDrift (500ms) |
db_auth_failures_total | counter | Failed client, inter-node, or admin authentication attempts |
db_tx_commit_1pc_total / ..._2pc_total | counter | Total committed single-partition (1PC) and cross-partition (2PC) transactions |
db_tx_conflict_total / db_tx_zombie_resolved_total | counter | SSI serialization conflicts and automatically cleaned expired 2PC zombie locks |
db_watch_lagged_total | counter | Slow Watch subscribers disconnected due to buffer overflow |
db_open_iterators / db_active_watchers / db_active_connections | gauge | Open Scan iterators, active Watch streams, and live network connections |
db_cache_hit_ratio | gauge | BlockCache hit ratio in 0.0 .. 1.0 |
db_lsm_level_bytes{level="L0".."L4"} | gauge | Total .sst bytes stored per LSM level |
db_lsm_tombstone_density | gauge | Peak tombstone ratio across active .sst files driving priority compaction |
db_kv_latency_microseconds | histogram | KV operation latency histogram in microseconds (1 us .. 10 s) |
db_stream_latency_microseconds | histogram | Stream operation latency histogram in microseconds |
db_tx_latency_microseconds | histogram | Transaction commit latency histogram in microseconds |
db_fsync_latency_microseconds | histogram | Physical fdatasync / F_FULLFSYNC latency histogram |
8. Complete Error Catalog (errors.Is)
All errors returned by the Go SDK preserve exact server error codes and match standard errors.Is(err, db.Err...) checks:
| Error Constant | Code | Cause and Recommended Action |
|---|---|---|
ErrNotFound | 1 | KV key, stream, or Seq does not exist or has expired via TTL |
ErrCASConflict | 2 | expectedVer in CAS did not match current version—inspect currentEntry and retry |
ErrTxConflict | 3 | SSI serialization conflict or live 2PC lock—retry Update with brief backoff |
ErrEmptyKey | 4 | Empty Key or StreamKey provided |
ErrKeyTooLarge | 5 | Exceeded length limit for Key (8 KiB), PartKey/StreamKey (512 B), or ConsumerGroup (256 B) |
ErrValueTooLarge | 6 | Value exceeds MaxValueSize (or stream Header > 64 KiB) |
ErrBatchTooLarge | 7 | Exceeded 10,000 ops or 16 MiB per batch/transaction |
ErrReservedNamespace | 8 | Attempted user access to reserved system namespace 0xFFFF (65535) |
ErrInvalidRange | 9 | Invalid scan or delete range bounds (StartKey >= EndKey) |
ErrIncompatibleValueType | 10 | AddInt64 invoked on a live non-integer key created via Put |
ErrIntegerOverflow | 11 | Signed int64 overflow in AddInt64 |
ErrStreamSeqOutOfRange | 12 | PatchStream or RedactStream called for Seq == 0 or Seq > HeadSeq |
ErrStreamTrimmed | 13 | Requested Seq < FirstSeq has already been removed by TrimStream |
ErrSnapshotExpired | 14 | View transaction or Scan iterator held longer than MaxSnapshotLifetime (5m) |
ErrTooManyPartitions | 15 | Transaction touched > 32 partitions or attempted cross-partition stream/DeleteRange in cluster mode |
ErrWatchLagged | 16 | Watch subscriber buffer overflowed—resync via Scan and reopen watch from new version |
ErrOverloaded | 17 | TLS handshake semaphore saturated or connection retries exhausted—apply backoff |
ErrDiskFull | 18 | Disk free-space circuit breaker tripped—reclaim space or expand the volume |
ErrClockSkew | 19 | Clock drift exceeded MaxClockDrift (500ms)—verify NTP daemon (chrony) |
ErrCorruption | 20 | On-disk CRC32C checksum mismatch or AES-GCM decryption failure |
ErrClosed | 21 | Operation attempted on a closed client, iterator, or stopped node |
ErrNotLeader / ErrPartitionMoved | 22 / 23 | Handled automatically by db.Client; surfaced only if no leader is elected within retries |
ErrUncertainCommit | 24 | Socket dropped after sending a single non-idempotent call—verify key state or use Update |
ErrUnauthorized / ErrIPForbidden | 25 / 26 | Invalid client/admin/cluster secret or source IP rejected by IPAllowlist |
ErrInvalidTopology / ErrStaleTopologyEpoch | 27 / 28 | Shard alignment violated or stale epoch sent to /topology or /migrate |
ErrDraining | 29 | Target node is draining for maintenance |
ErrInvalidConfig / ErrInvalidArgument | 30 / 31 | Invalid configuration parameters or call arguments |
Related Guides
- Architecture of
IDENTITY,TOPOLOGY.bin, andreserve.ballast: Slyber DB Overview and Architecture - Disk and memory thresholds: Limits, Configuration, and CLI Reference
- Replica group scaling and topology: Multi-Raft Cluster Deployment and Scaling