Repository navigation
Command Line Client
kingres-cli is the command-line client of the KingresDB REST API. It is part of release 0.2.0 (2026-11-30); it is not in 0.1.0 or 0.1.1. From 0.2.0 it is in the Debian package as /usr/bin/kingres-cli (with the man page kingres-cli(1)), in the container image, and in the RPM, and it builds for Windows and macOS with go build ./cmd/kingres-cli in kingres/control-plane (no package is made for them). Until then, use the REST API (REST API Reference) or the console (Web Console).
It calls only the REST API that the console uses. Everything it does is subject to the cluster roles of the signed-in PostgreSQL role and is written to the audit log (Security Model, Control Plane and REST API). It is one static binary with the standard library only (plus golang.org/x/term for the password prompt). The reference is the README of kingres-cli; the operator guide, section 2a, shows it in use.
kingres-cli login --url https://db1.example.com:8091 --ca-file /etc/kingres/ca.pem --user root_admin
kingres-cli cluster status
kingres-cli server list
kingres-cli database create sales --sharded --buckets 64 --wait
kingres-cli table distribute sales/public.orders --column customer_id --wait
kingres-cli help lists the groups of commands (session, cluster, servers, databases, schemas and tables, rebalance and buckets, failover, tasks, alerts and audit, configuration, ledger, transfers, roles, this server, query), and kingres-cli help COMMAND gives the arguments and flags of one. A table is written DATABASE/SCHEMA.TABLE.
-
Login with profiles and TLS trust.
loginasks for the password on the terminal, or reads it from--password-file(-is standard input) orKINGRES_PASSWORD. The answer is a bearer token kept in a per-user config file (kingres/cli.jsonin the user config directory), never the password. The file is written atomically and is private to the user (mode 0600 on Linux and macOS, an access list for the current user on Windows).--profile NAMEkeeps several clusters side by side. A session belongs to the server that issued it; if that server is down, sign in again with--urlof another server. -
TLS.
--ca-fileadds the CA of the cluster to the system roots,--server-namenames the certificate to check. There is no flag that turns the check off. Plainhttp://works only for a loopback address; for any other address every command refuses before it sends anything. -
No secrets on the command line. A password, a setup token or any other secret is never taken from an argument, so it is not in the process list or the shell history: use a prompt, a file, an environment variable or
@fileand@-for a request body. -
Tables or
--json. The default is a table (a list) or a list of fields (one object); a value the server does not know is shown as-, never as 0.--jsonprints the answer as it came and nothing else on standard output, sokingres-cli server list --json | jqworks. Progress and warnings go to standard error. Lists with pages take--limit,--cursorand--all. -
--waitand--retry. An operation that cannot finish within a request answers with a task.--waitfollows the task until it is done, failed or paused (--wait-timeout, default 30 minutes; it never cancels the task);task wait IDdoes the same later.--retry Nrepeats a call that got 503 or 429 withRetry-After, for example while a map group fails over. Commands that destroy data (database drop,server remove,table undistribute,failover abandon) ask[y/N]on a terminal and refuse without one;--yesanswers for you. -
Transfers with resume and SHA-256 checks.
table export --out FILEstarts the export, waits, downloads the file and compares its SHA-256 with the one the server recorded; the file appears under its name only after the check and never replaces an existing file. A download that breaks continues when you run the command again. An upload (table import,database import,database validate-archive) hashes the file, sends it in chunks of 64 MiB, repeats a broken chunk from the offset the server reports, and continues with--resume-upload ID. Transfers need HTTPS and the cluster settingdataTransfer.enabled(Backup Restore and PITR). -
Extensions and the preload list (since 0.2.0):
extension catalog,extension show,extension packages;database extension list,install,update,removeandplan-switch;database extension-catalogueanddatabase feature-set;preload show,plan,checkandset. See Extensions. -
Paused preload tasks and the instances of a preload change (since 0.2.1; not in 0.2.0):
task resumeresumes a paused task of the preload change (POST /tasks/{taskId}/resume), andpreload serversshows the instances of each server and whether each runs the cluster list. See Extensions. -
Ledger checks and the audit of the publication (since 0.2.1; not in 0.2.0):
ledger check-reportsandledger check-reportlist and show the stored reports of the ledger checks;ledger verify --checks anchorsstarts a verification with the checkanchors;ledger auditshows the settings and state of the scheduled audit of the publication,ledger audit-setchanges them,ledger audit-nowruns an audit at once, andledger audit-ackacknowledges an altered finding (per log with--shard-group). See Ledger Anchoring. -
api callfor the rest.kingres-cli api list [FILTER]lists every operation of the contract the binary was built from, with the command that calls it.kingres-cli api call OPERATION --path NAME=VALUE --query NAME=VALUE --data JSON|@filecalls any of them, including the first-run setup of a node and the operations that have no command of their own.
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | other failure |
| 2 | usage error |
| 3 | cannot connect, or the TLS certificate is not trusted |
| 4 | not signed in, bad credentials, expired session (401) |
| 5 | not allowed for the role (403) |
| 6 | not found (404, 410) |
| 7 | conflict with the current state (409) |
| 8 | request rejected as wrong or impossible (400, 413, 416, 422) |
| 9 | server unavailable or rate limited (429, 503, 5xx) |
| 10 | the task ended failed, or is paused and waits for an operator (--wait) |
| 11 |
--wait-timeout ran out; the task goes on |
| 12 | interrupted (Ctrl-C), or "continue?" was answered no |
The codes are stable: a value is never reused for another meaning.
The rule of the project is that every change of the REST API goes through the contract and also gets its command in the CLI. The code is kingres/control-plane/internal/cli and cmd/kingres-cli, in the module of the control plane. The CLI names an operation by its operationId and builds the request from the generated operation table internal/contract, so it never copies a method or a path. When an operation is added, renamed or changed in kingres/api/openapi.yaml:
- Bump the contract version and run
go generate ./internal/contract. - Run
go test ./internal/cli. The coverage testTestEveryOperationIsCoveredOrListedfails for every new operation until it has a command (aSpecininternal/cli/commands.go) or is listed innotCoveredininternal/cli/coverage.gowith a reason (it is then reached withapi call). -
TestSpecsMatchTheContractchecks every command against the contract: that its arguments fill exactly the path parameters, and that the query parameters, request members and table columns exist in the schemas. - Add the case to
TestBodiesAndQueriesand, for a new table, a golden file. A secret member is aSecretand is read from a file, the environment or a prompt, never from a flag. - A change of an exit code is a change of the interface: it needs a new value.
The tests run against a fake server; TestCLIEndToEnd in internal/clustertest runs the main commands against a real three-server cluster over HTTPS.
A session belongs to the server that issued it, no package is made for Windows or macOS (the binary builds there), and there is no shell completion yet (Limitations and Known Issues).
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations