CLI Reference
Every command-line tool that ships with VeltrixDB — the operator CLI, backup/restore tool, migration and chaos-testing utilities, load generator, and Kubernetes integrations — with real invocation syntax pulled from each tool's source.
All tools live under cmd/ in the VeltrixDB repository and build independently with go build -o <name> ./cmd/<dir>. None of them require the full server dependency tree at runtime; each talks to a running veltrixdb server over TCP and/or the admin HTTP API, except where noted as an offline/file-based tool.
veltrix — operator CLI
The primary day-to-day operator tool: cluster health, GC/compaction status, cache and WAL stats, live dashboards, and direct key read/write/delete via the text protocol. Think redis-cli merged with kubectl top.
go build -o veltrix ./cmd/veltrix
Global flags
| Flag | Default | Description |
|---|---|---|
--addr | 127.0.0.1:2112 | Admin/metrics HTTP address. |
--tcp | 127.0.0.1:9000 | TCP data address (text protocol). |
--watch | 0 | Refresh interval in seconds for status/compaction/etc.; 0 runs once. |
--json | false | Print raw JSON instead of formatted tables. |
--no-color | false | Disable ANSI colors (auto-disabled when stdout is not a TTY). |
--prefix | (empty) | Key prefix filter, used by cdc-tail. |
Subcommands
| Subcommand | Purpose |
|---|---|
status | Full node health + ops summary: health/readiness, index size, cache, WAL, CDC, per-disk VLog table, admission-control state. |
nodes | Cluster topology table — role (leader/follower), Raft term, health, address, replication lag. Backed by /admin/cluster. |
compaction (alias gc) | Per-disk VLog GC status: size, live/dead bytes, GC ratio (color-coded), GC run counters, admission-control thresholds. |
replication (alias repl) | Per-replica state, consistency level, lag, ACK watermark. |
cache | LIRS cache hit rate, fill bar, evictions, hot-key list. |
wal | WAL bytes written, entry count, flush count, average batch size. |
quotas (alias quota) | Per-namespace quota usage table. Backed by /admin/quotas. |
cdc | CDC broker stats: events broadcast, dropped, active subscribers. |
cdc-tail | Streams live CDC events to stdout (Ctrl+C to stop). Supports --prefix. |
scrubber | Data-integrity scrubber status: records scanned, corruption count. |
metrics [filter] | Raw Prometheus metrics, optionally grep-filtered by substring. |
traces | Recent OTel spans (slow ops and errors) from the in-process ring buffer. |
top | Live full-screen dashboard, refreshing every --watch seconds (default 2 if --watch is unset for this subcommand). |
ping | Round-trip latency check — 5 TCP PINGs plus one HTTP /healthz check. |
put KEY VALUE | Write a key via the text protocol. |
get KEY | Read a key via the text protocol. |
del KEY | Delete a key via the text protocol. |
checkpoint | Force a WAL checkpoint on all disks. Calls POST /admin/checkpoint. |
backup DEST_DIR | Trigger a full backup to DEST_DIR on the server host. Calls POST /admin/backup. |
version | Print engine schema version + encryption status. |
Examples
veltrix status
veltrix top --watch 2
veltrix compaction --watch 5
veltrix cdc-tail --prefix orders/
veltrix metrics vlog_gc
veltrix put mykey "hello world"
veltrix get mykey
veltrix backup /mnt/backup/2026-07-05
veltrix checkpoint
veltrix --addr 10.0.0.5:2112 status
veltrixdb-backup — backup and restore tool
Offline/online backup and restore, including point-in-time recovery (PITR) and direct cloud upload/download to S3, GCS, or Azure. The engine must be stopped before restore or restore-pitr; full and incremental backups are safe to run against a live engine.
go build -o veltrixdb-backup ./cmd/backup
Local backup subcommands
| Subcommand | Key flags | Purpose |
|---|---|---|
full | --data-dirs (required), --dest (required), --cache-mb (default 64) | Create a full backup. Engine can be running. |
incremental | --data-dirs, --dest, --base (all required), --cache-mb | Create an incremental backup relative to a base backup's manifest. |
restore | --chain, --data-dirs (both required) | Restore from a comma-separated backup chain (oldest first). Engine must be stopped. |
Point-in-time recovery subcommands
| Subcommand | Key flags | Purpose |
|---|---|---|
archive-status | --archive (required) | Show WAL-archive segments, version range, and time coverage per disk. |
restore-pitr | --base-backup, --archive, --until, --data (all required) | Restore a full base backup plus archived WAL up to an exact version:N or RFC3339 timestamp. Target data dirs must be fresh/empty. |
Cloud subcommands
| Subcommand | Key flags | Purpose |
|---|---|---|
upload | --src, --provider, --bucket, plus provider auth flags | Upload a local backup directory to S3 / GCS / Azure. |
download | --cloud-path, --dest, --provider, --bucket | Download a cloud backup to a local directory. |
list-cloud | --provider, --bucket | List all backups stored in cloud storage. |
full-cloud | --data-dirs, --provider, --bucket, --cache-mb | Full local backup + upload to cloud in one step. |
Shared cloud flags (from cloudFlags): --provider (s3|gcs|azure), --bucket, --prefix (default veltrixdb-backups), and provider-specific credentials: --region/--aws-access-key/--aws-secret-key for S3, --gcs-token/--gcs-cred-file for GCS, --azure-account/--azure-key for Azure. Each credential flag can instead be supplied via environment variable: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_SESSION_TOKEN, GOOGLE_APPLICATION_CREDENTIALS, GCS_ACCESS_TOKEN, AZURE_STORAGE_ACCOUNT, AZURE_STORAGE_KEY, AZURE_STORAGE_CONTAINER.
Examples
# Full local backup of a single-disk server
veltrixdb-backup full --data-dirs=/data --dest=/backup/full-2026-07-05
# Upload a local backup to S3
veltrixdb-backup upload \
--src=/backup/full-2026-07-05 \
--provider=s3 --bucket=my-veltrix-backups --region=us-east-1
# Full backup straight to GCS in one step
veltrixdb-backup full-cloud \
--data-dirs=/data \
--provider=gcs --bucket=my-bucket --gcs-cred-file=/sa.json
# Restore (engine must be stopped)
veltrixdb-backup restore --chain=/backup/full,/backup/inc1 --data-dirs=/data-new
# Inspect the PITR WAL archive
veltrixdb-backup archive-status --archive=/backup/wal-archive
# Point-in-time restore to an exact moment
veltrixdb-backup restore-pitr \
--base-backup=/backup/full-2026-07-05 \
--archive=/backup/wal-archive \
--until=2026-07-05T14:30:00Z \
--data=/data-new
# ...or exact to a single write: --until=version:123456
See Backup & Restore for the full disaster-recovery workflow.
veltrix-admin — low-level administrative CLI
A separate, lower-level admin tool (cmd/admin) for offline VLog integrity checks and direct text-protocol operations that don't go through the HTTP admin API.
go build -o veltrix-admin ./cmd/admin
| Subcommand | Key flags | Purpose |
|---|---|---|
scan | --addr, --user, --password | Prints server INFO, then attempts a SCAN over the text protocol (not currently implemented server-side — falls back to a note pointing at stats or offline check). |
stats | --addr, --user, --password | Prints the server's INFO response as a formatted key/value table. |
compact | --addr, --user, --password | Sends a COMPACT text command. Not currently wired server-side — the engine's GC runs automatically every 30s regardless; this subcommand is a documented no-op stub today. |
check | --data or --data-dirs | Offline CRC32C corruption scan — walks each disk's vlog_active.dat directly, verifying every record's stored checksum. No running server required. |
repair | --addr, --key, --user, --password | Tombstones (deletes) a specific key on a running server. |
hash-password | --user, --password | Generates a SHA-256 password hash and a ready-to-paste JSON snippet for the RBAC --auth-config file. |
Examples
veltrix-admin scan --addr :9000
veltrix-admin stats --addr :9000 --user admin --password secret
veltrix-admin check --data-dirs /mnt/nvme0,/mnt/nvme1
veltrix-admin repair --addr :9000 --key corrupt-key-001 --user admin --password secret
veltrix-admin hash-password --user alice --password secret
veltrix (cmd/veltrix) is the modern, richly-formatted operator CLI covered above and is the one referenced by the top-level README. veltrix-admin (cmd/admin) is an older, lower-level tool focused on offline VLog integrity checks and RBAC password hashing.
veltrix-migrate — bulk data movement
Exports keys to JSONL, imports JSONL into a cluster, or copies directly between two clusters, using only the binary protocol plus /admin/stats for progress reporting.
go build -o veltrix-migrate ./cmd/veltrix-migrate
| Mode | Flags | Purpose |
|---|---|---|
export | --src (required), --src-admin, --prefix, --progress-every | Reads every key from a cluster and emits JSONL ({"k": "...", "v": "<base64>"}) to stdout. |
import | --dst (required), --progress-every | Reads JSONL from stdin and PUTs each entry into the target cluster. Idempotent. |
migrate | --src, --dst (both required), --prefix, --progress-every | Combines export + import in one pass, copying directly from --src to --dst. |
veltrix-migrate export --src 127.0.0.1:9000 --prefix orders/ > out.jsonl
veltrix-migrate import --dst replica:9000 < out.jsonl
veltrix-migrate migrate --src primary:9000 --dst replica:9000 --prefix orders/
PRODUCTION GAP comment in the source, there is no /admin/scan-keys endpoint yet, so listKeys() cannot actually enumerate keys from /admin/stats alone — it returns an empty list on stock builds. export and migrate are effectively non-functional for full-keyspace enumeration until that endpoint lands; import (reading pre-staged JSONL from stdin) works today.
veltrix-chaos — chaos-engineering harness
Inflicts controlled failures on running processes or Kubernetes pods to verify resilience claims: process kills, pause/resume (simulating GC pauses), network loss/delay, clock skew, and randomized soak testing.
go build -o veltrix-chaos ./cmd/veltrix-chaos
| Command | Usage | Purpose |
|---|---|---|
kill | kill TARGET | SIGKILL the target (process or pod). |
pause | pause TARGET DURATION | SIGSTOP the target, sleep for DURATION (e.g. 5s), then SIGCONT. Local targets only. |
network | network drop|delay TARGET PCT_OR_MS | Injects packet loss or delay via tc/iptables. Kubernetes targets only. |
slow-disk | slow-disk TARGET DURATION | Intended to inject artificial fdatasync delay via charybdefs. Currently a placeholder — warns if charybdefs isn't on PATH and performs no real fault injection. |
clock-skew | clock-skew TARGET ±SECONDS | Adjusts the system clock on a Kubernetes pod by the given signed seconds (requires SYS_TIME). |
soak | soak TARGET DURATION | Applies randomized faults (currently just pause) at random intervals across the given duration window. |
Target descriptor syntax: pid:NUMBER (local process by PID), process:NAME (local process by exec name, first match via pgrep -f), or k8s:NAMESPACE/POD (Kubernetes pod, operated on via kubectl).
veltrix-chaos kill process:veltrixdb
veltrix-chaos pause pid:4821 5s
veltrix-chaos network drop k8s:veltrixdb/veltrixdb-0 10
veltrix-chaos clock-skew k8s:veltrixdb/veltrixdb-1 +30
veltrix-chaos soak k8s:veltrixdb/veltrixdb-0 10m
All faults assume root or CAP_SYS_ADMIN on the target host. Compared to Jepsen, the source notes this trades formal rigor for zero JVM/Clojure dependency and trivial embedding in Go test suites via Inflict(...).
loadtest — concurrent load generator
A read/write load tester supporting single-op and batched (MPut/MGet) modes, with live throughput reporting and P50–P99.9 latency percentiles.
go run ./cmd/loadtest [flags]
| Flag | Default | Description |
|---|---|---|
--addr | 127.0.0.1:9000 | VeltrixDB TCP address. |
--mode | mixed | Workload mode: write | read | mixed. |
--concurrency | 50 | Number of parallel worker goroutines. |
--duration | 30 | Test duration in seconds. |
--warmup | 5 | Warmup seconds before recording stats (write-only warmup phase). |
--num-keys | 1000000 | Keyspace size (key:0 … key:N-1). |
--value-size | 64 | Value payload size in bytes. |
--read-ratio | 0.7 | Fraction of reads in mixed mode. |
--dial-timeout | 5 | TCP dial timeout in seconds. |
--report-every | 1 | Live stats interval in seconds. |
--safe-reads | false | Only read keys that have already been written (eliminates not-found errors during mixed ingestion). |
--key-offset | 0 | Start key index offset, for continuing a previous run without overlap. |
--batch-size | 1 | Entries per MPut/MGet batch. Values >1 switch to the batched code path, engaging server-side block packing (up to ~25× disk density gain for tiny values). Latency is reported per-batch; per-key amortized = batch-P99 / batch-size. |
--log-errors | 5 | Log the first N distinct errors per worker to stderr. 0 = silent. |
Examples
# 30-second mixed 70% reads / 30% writes, 64 workers, 1M keyspace
go run ./cmd/loadtest --mode=mixed --read-ratio=0.7 --concurrency=64 --duration=30
# Write-only warmup then read-only benchmark
go run ./cmd/loadtest --mode=write --duration=10
go run ./cmd/loadtest --mode=read --duration=30
# Batched writes via MPut-1024 (engages block packing)
go run ./cmd/loadtest --mode=write --batch-size=1024 \
--concurrency=8 --duration=30 --value-size=128
# Batched reads via MGet-256
go run ./cmd/loadtest --mode=read --batch-size=256 \
--concurrency=64 --duration=30
kubectl-veltrix — kubectl plugin
A dependency-free kubectl plugin that resolves a VeltrixDB pod by label selector, opens a kubectl port-forward to its admin port, and hits the HTTP admin API on localhost. No client-go or cobra dependency — it shells out to kubectl directly so auth and kubeconfig behavior always match the operator's normal workflow.
go build -o kubectl-veltrix ./cmd/kubectl-veltrix
# install: place the binary on PATH; kubectl auto-discovers it by the
# kubectl-PLUGIN naming convention.
Flags
| Flag | Default | Description |
|---|---|---|
--namespace, -n | veltrixdb | Kubernetes namespace. |
--label-selector, -l | app.kubernetes.io/name=veltrixdb | Pod selector. |
--admin-port | 2112 | Admin HTTP port on the pod. |
--prefix | (empty) | Key prefix filter for cdc-tail. |
Commands
| Command | Backing endpoint | Purpose |
|---|---|---|
stats | GET /admin/stats | Print engine stats from the first matching pod. |
gc-status | GET /metrics (filtered) | Print VLog GC + scrubber metric lines. |
checkpoint | POST /admin/checkpoint | Force a WAL checkpoint. |
migrate | POST /admin/migrate | Run schema migrations. |
quotas | GET /admin/quotas | List per-namespace quotas. |
quota-set NS WPS MAX | POST /admin/quotas | Set writes_per_sec=WPS, max_keys=MAX for namespace NS. |
cdc-tail [--prefix=] | GET /admin/cdc | Stream CDC events to stdout until interrupted. |
version | GET /admin/version | Print engine + schema version. |
kubectl veltrix stats
kubectl veltrix gc-status
kubectl veltrix quota-set tenant_42 5000 1000000
kubectl veltrix cdc tail --prefix orders/
kubectl veltrix -n veltrixdb-prod -l app.kubernetes.io/name=veltrixdb stats
kubectl veltrix backup s3://... as a one-shot backup command, but it is marked TODO in source and not wired into the command switch — only stats, gc-status, checkpoint, migrate, quotas, quota-set, cdc-tail, and version are functional today.
repl-ship — cross-region replication shipper
Tails a local server's /admin/cdc stream and forwards each event to a remote VeltrixDB cluster's binary protocol — PUT events become a remote MultiPut, DEL events become a remote delete. Designed for asynchronous, eventually-consistent geo-replication, with exponential-backoff retries and a deadletter file for permanent failures.
go build -o repl-ship ./cmd/repl-ship
repl-ship --src http://primary:2112 \
--src-token "$VELTRIX_ADMIN_TOKEN" \
--dst-tcp replica.us-east:9000 \
--batch 64 \
--checkpoint /var/lib/repl-ship/ckpt
--checkpoint (v1.1.0), a restarted shipper replays exactly the delta it missed via the durable /admin/changes feed — shipper downtime no longer loses events. The remaining limits: replication is async (writes committed at the source but not yet shipped are lost if the source region dies), conflict resolution is last-write-wins only, and there is no back-pressure signal to the source when the destination is degraded.
admin (cmd/admin)
This is the same binary documented above as veltrix-admin — its source lives at cmd/admin/main.go and it is conventionally built with the output name veltrix-admin. See that section for its full subcommand table.
Tool index
| Binary | Source directory | One-line purpose |
|---|---|---|
veltrix | cmd/veltrix | Primary operator CLI — status, compaction, nodes, top, put/get/del, backup. |
veltrixdb-backup | cmd/backup | Full/incremental backup, restore, PITR, and cloud upload/download. |
veltrix-admin | cmd/admin | Offline VLog integrity checks and low-level text-protocol admin. |
veltrix-migrate | cmd/veltrix-migrate | Bulk export/import/migrate of keys between clusters via JSONL. |
veltrix-chaos | cmd/veltrix-chaos | Chaos-engineering fault injection (kill, pause, network, clock-skew, soak). |
loadtest | cmd/loadtest | Concurrent read/write load generator with latency percentiles. |
kubectl-veltrix | cmd/kubectl-veltrix | kubectl plugin wrapping the admin HTTP API via port-forward. |
repl-ship | cmd/repl-ship | Cross-region CDC-based replication shipper. |