Skip to main content

CLI Reference

The pg-kinetic binary can run the proxy or execute operator commands such as preflight, route preview, policy preview, compatibility checks, regression runs, profiling, and benchmark validation.

Examples assume the installed binary or container entrypoint is named pg-kinetic. Container examples use ghcr.io/hookwoods/pg-kinetic:latest.

Command Model

All commands share the global runtime flags documented in Configuration. Command-specific flags are listed here.

CommandPurposeOutputSuccess exitFailure exit
no subcommandRun the proxy process.logs and network listenersprocess keeps runningnonzero on config, bind, TLS/auth asset, startup, or runtime failure
preflightValidate deployable config and runtime assets.JSON report0 when error_count = 0nonzero when config cannot load or report has errors
route-previewEvaluate offline sharding route selection.JSON summary0 when preview succeedsnonzero when preview file/input cannot parse or selection fails
policy-previewEvaluate offline policy model behavior.JSON summary0 when preview succeedsnonzero when preview file/input cannot parse or policy validation fails
benchmark validateValidate benchmark scenario structure.JSON summary0 when scenario is validnonzero on validation error
benchmark runPrepare benchmark report; live execution currently requires --dry-run.JSON report and optional file0 for valid dry runnonzero on invalid scenario or live execution request
benchmark compareCompare baseline/current benchmark reports.JSON comparison0 unless comparison outcome is failednonzero on invalid reports or failed comparison
benchmark scoreScore benchmark report regression budgets.JSON score0, or 0 with --release when release gate passesnonzero with --release when release gate fails
compat listList compatibility suites from a manifest.JSON list0nonzero on manifest or filter error
compat runRun selected compatibility suites.JSON report and optional file0 when no selected suite failsnonzero on runner error or failed suite
regression listList regression cases from a manifest.JSON list0nonzero on manifest or filter error
regression runRun selected regression cases.JSON report and optional file0 when no selected case failsnonzero on runner error or failed case
profile validateReport local profiling tool availability.JSON status map0nonzero on unexpected validation error
profile runRun a selected profiler for a benchmark scenario.JSON report0 when profiler run succeeds or an optional profiler is skippednonzero on invalid scenario or profiler execution failure

Run The Proxy

pg-kinetic --config-file /etc/pg-kinetic/pg-kinetic.toml

Container:

docker run --rm \
-v "$PWD/pg-kinetic.toml:/etc/pg-kinetic/pg-kinetic.toml:ro" \
ghcr.io/hookwoods/pg-kinetic:latest \
--config-file /etc/pg-kinetic/pg-kinetic.toml

Preflight

Validate a config before rollout:

pg-kinetic preflight --config /etc/pg-kinetic/pg-kinetic.toml

Container:

docker run --rm \
-v "$PWD/pg-kinetic.toml:/etc/pg-kinetic/pg-kinetic.toml:ro" \
ghcr.io/hookwoods/pg-kinetic:latest \
preflight --config /etc/pg-kinetic/pg-kinetic.toml

Treat preflight errors as deployment blockers.

Flags:

FlagRequiredDefaultMeaning
--config pathyesnoneConfig file to parse and validate.
--format jsonnojsonOutput format; JSON is the only supported value.

JSON shape:

{
"ok": true,
"config": "deploy/pg-kinetic.toml",
"warning_count": 0,
"error_count": 0,
"warnings": [],
"errors": []
}

Route Preview

Preview routing and sharding models without live traffic:

pg-kinetic route-preview \
--config /etc/pg-kinetic/pg-kinetic.toml \
--database billing \
--user reporter \
--application-name dashboard \
--sql "select * from orders where tenant_id = 'tenant-a'"

The output is JSON with the selected route, shard id when known, backend role when known, and the decision reason. This is a structural preview command, not a live operation.

Flags:

FlagRequiredDefaultMeaning
--config pathyesnoneOffline preview TOML containing [sharding].
--database nameyesnoneSynthetic startup database.
--user nameyesnoneSynthetic startup user.
--sql sqlyesnoneSQL text used for shard hint/key extraction.
--application-name namenounsetSynthetic application name for scope matching.

JSON shape:

{
"ok": true,
"route": "billing/reporter/<none>/default",
"shard_id": "orders-b",
"backend_role": "replica",
"reason": "hash_match",
"shard_reason": "hash_match"
}

Policy Preview

Evaluate policy rules against a synthetic request context:

pg-kinetic policy-preview \
--config /etc/pg-kinetic/pg-kinetic.toml \
--database billing \
--user reporter \
--route primary \
--shard tenant-a \
--query-class read_candidate

The preview context contains redacted secret-bearing fields so policy model behavior can be inspected safely. This is a structural preview command, not a live operation.

Flags:

FlagRequiredDefaultMeaning
--config pathyesnoneOffline preview TOML containing [policy] and optional [sharding].
--database nameyesnoneSynthetic database.
--user nameyesnoneSynthetic user.
--route idyesnoneSynthetic route id before policy adjustment.
--shard idyesnoneSynthetic shard id before policy adjustment.
--query-class classyesnoneOne of write, read_only, read_candidate, transaction_control, session_mutation, copy, unknown.
--application-name namenounsetSynthetic application name.
--format jsonnojsonOutput format; JSON is the only supported value.

JSON shape:

{
"ok": true,
"policy_mode": "dry_run",
"original_route": "primary",
"policy_adjusted_route": "primary",
"original_shard": "orders-a",
"policy_adjusted_shard": "orders-a",
"action": "require_replica",
"dry_run_outcome": "dry_run",
"dry_run_reason": "would_require_replica",
"deny_reason": null,
"sqlstate": null,
"context": "database=billing, user=reporter, sensitive_inputs=<redacted>"
}

Exit Codes

Command classSuccessFailure
Proxy runprocess stays runningstartup, config, bind, TLS/auth asset, or runtime error exits nonzero
preflightzero when validation succeedsnonzero when errors are found or config cannot load
route-previewzero with JSON outputnonzero when config or input cannot be parsed
policy-previewzero with JSON outputnonzero when config or input cannot be parsed
benchmark, compat, regression, profilezero when the selected check succeedsnonzero on validation failure, failed budget, failed smoke, or invalid arguments

Compatibility Commands

pg-kinetic compat list
pg-kinetic compat run --target pg-kinetic --smoke

Use filters such as --language, --library, --target, and --category to narrow the matrix.

Flags:

CommandFlags
compat list--manifest path default regression/manifest.toml; optional --language, --library, --target, --category, --smoke, --format json.
compat runSame filters as compat list, plus optional --output path.

List output contains ok and suites[]. Run output contains the compatibility report and exits nonzero when selected suites fail.

Regression Commands

pg-kinetic regression list --manifest regression/manifest.toml
pg-kinetic regression run --manifest regression/manifest.toml --category smoke

Regression outputs are JSON and redact sensitive text before printing errors.

Flags:

CommandFlags
regression listRequired --manifest path; optional --category, --platform, --format json.
regression runRequired --manifest path; optional --category, --platform, --output path, --format json.

List output contains ok and cases[]. Run output contains selected case results and exits nonzero when selected cases fail.

Benchmark Commands

Benchmark commands are for controlled performance validation, not initial installation:

pg-kinetic benchmark validate --scenario bench/scenarios/benchmark-simple-query.toml
pg-kinetic benchmark run --scenario bench/scenarios/benchmark-simple-query.toml --dry-run
pg-kinetic benchmark compare --baseline bench/baselines/simple.json --current bench/results/simple.json
pg-kinetic benchmark score --baseline bench/baselines/simple.json --current bench/results/simple.json

Live load execution and local-noise interpretation are covered in Benchmarking.

Flags:

CommandFlags
benchmark validateRequired --scenario path.
benchmark runRequired --scenario path; optional --format json, --output path, --dry-run. Live execution is not implemented without --dry-run.
benchmark compareRequired --baseline path and --current path.
benchmark scoreRequired --baseline path and --current path; optional --format json, --release.

Profiling Commands

pg-kinetic profile validate
pg-kinetic profile run --scenario bench/scenarios/benchmark-simple-query.toml --kind flamegraph
pg-kinetic profile run --scenario bench/scenarios/benchmark-simple-query.toml --kind perf

Supported profile tools are validated locally because platform support differs between Windows, Linux, and developer machines.

Flags:

CommandFlags
profile validateNo command-specific flags.
profile runRequired --scenario path and `--kind flamegraph

Common failures: profiler executable missing, OS support missing, invalid benchmark scenario, or output path not writable.