Repository navigation
Servers Databases and Roles
Day-to-day administration through the REST API or the console: servers and server groups, databases and tables, roles, grants, network access and cluster settings. Operations are named by their operationId in openapi.yaml; the minimum role of each is in REST API Reference. Adding and removing servers is in Cluster Setup.
-
GET /servers,GET /servers/{serverId}(kingres_readonly). A server is a machine; its id is the host it registered under, an opaque string that clients compare for equality only. - Status values include
pendingRebalance(a server that owns no buckets yet) anddraining(it should hold none), besidesdecommissioningwhile it is added, removed or left, anddead/suspect states reported by the heartbeat (High Availability). -
PATCH /servers/{serverId}(kingres_ops) changes onlyserverGroup,shouldHaveShardsandweight(a larger weight gets more buckets at the next rebalance). SettingshouldHaveShards: falsemakes the serverdraining; setting it to true makes a server without bucketspendingRebalance. Nothing moves by itself: run a rebalance (Rebalancing). It is refused with 409 while a rebalance runs or while the server is being added or removed; a stopped rebalance does not block it. A change ofshouldHaveShardsorweightis also refused (409operation_in_progress) while a database import is unfinished. - Server groups (a rack or a zone, not a shard group):
GET/POST /server-groups,DELETE /server-groups/{serverGroupName}. A name matches^[A-Za-z0-9][A-Za-z0-9_.-]{0,62}$, case-sensitive; a group that has servers cannot be deleted (409server_group_not_empty). Standbys are placed on servers outside the primary's server group where possible. - Certificates:
POST /servers/{serverId}/certificates/renewalsand.../revocations(kingres_admin). The escrow of the certificate authority key isGET/PUT /certificate-authority/escrowandPOST /certificate-authority/escrow/rotations(off until switched on; see High Availability). - Emptying a server for removal:
POST /servers/{serverId}/drain(preview:.../drain-preview); failing a server over or switching its primaries over:POST /servers/{serverId}/failover(High Availability, Rebalancing). - This server (local scope, never forwarded): instances (
start,stop,restart), resources, logs, andPATCH /this-server/settingsfor the memory quota, the log level and the log directory. The log level takes effect at once; the memory quota and the log directory need an instance restart (restartRequired: true). Data paths and client ports cannot be changed.
POST /databases (kingres_admin) starts a task that creates the database on every shard group, installs kingres_shard and kingres_ledger as selected, records the settings and applies the durability level. The body has name, general (encoding, collation), sharding (enabled, mode: rows, schemas or both, bucket count), replication and ledger. Immutable after creation: name, general.encoding, general.lcCollate, general.lcCtype and sharding.bucketCount (the default bucket count is 128, range 1 to 4096). The task cleans up a partial database on failure and waits for a server that is down.
-
PATCH /databases/{databaseName}: owner, connection limit and durability apply at once; enabling sharding or the ledger is a task. Sharding and the ledger can be turned on but never off (422). The sharding mode can be changed while no schema or table of the other kind exists (409sharding_mode_in_useotherwise). The replica count is a cluster setting, not a database one. -
DELETE /databases/{databaseName}?confirm=<name>drops it on every group; irreversible, the name must be repeated. Ledger tables do not protect a database from being dropped; the audit log keeps the record. - Durability per database:
async=synchronous_commit = local,sync=on(default, waits for a quorum of synchronous standbys to flush),syncApply=remote_apply. - Tables:
GET /databases/{db}/tables,PUT .../tables/{table}/distribution(hash or reference table; a task) andPUT .../tables/{table}/ledger. The contract text states what the extension refuses (a ledger table cannot be distributed, and a table with a key, trigger or other feature the extension does not support is refused with the condition named). A table that already holds rows can be distributed, turned back into an ordinary table, altered and partitioned as tasks with a preview (Sharding Table Lifecycle); the SQL route is in Sharding. - Schemas:
GET /databases/{db}/schemas,PUT/DELETE .../schemas/{schema}/distributionandPOST .../schemas/{schema}/movesfor databases sharded by schemas. - Moving data in and out: CSV export and import of a table and export and import of a whole database (
/data-exports,/data-uploads,/database-imports,/databases/{db}/export); both are described in the operator guide (sections 12 and 13) and, for the database form, in Backup Restore and PITR. - Bucket views:
colocation-groups,colocation-groups/{id}/buckets,bucket-distribution.
Panel accounts are PostgreSQL roles (ADR 0015). A role signs in with POST /auth/login when it has LOGIN and belongs to at least one of four built-in cluster roles. They form a hierarchy: kingres_admin includes kingres_ops, which includes kingres_readonly, which includes kingres_stats (metrics and the session only).
-
GET /cluster-roleslists the four roles.POST /rolescreates a role on every shard group; the password travels as a verifier, never as plaintext.PATCH,DELETE /roles/{roleName},PUT /roles/{roleName}/membershipsandPUT /roles/{roleName}/cluster-roles(the complete list; an empty list removes panel access). All needkingres_admin. - Refusals: the last
kingres_admincannot be removed or dropped (409last_admin), a role that owns objects or is the caller cannot be dropped (409role_in_use). - Since 0.2.1 a role that is handed out is judged by every membership,
ADMIN OPTIONincluded, and is refused with 400 if it reaches a role that is a superuser,REPLICATION,BYPASSRLSor one ofpg_execute_server_program,pg_read_server_files,pg_write_server_files; the signed-in role of the query workbench and the imports is judged only by the memberships it can use (SETorINHERIT), so an administrator is not refused because of a role it manages. - A server that cannot be reached during a role or grant change gets a task
replicate.applythat waits for it. - Grants:
GET/POST /grants,POST /grants/revocations, andPOST /grants/template-applicationswith three templates on a database:readOnly(CONNECT, USAGE on all schemas, SELECT on all current and future tables),readWrite(adds INSERT, UPDATE, DELETE, not on append-only ledger tables) andowner. Table and schema grants are replayed by the control plane only for databases withoutkingres_shard, whose extension propagates them itself. - Connect over TCP with a role (
kingres-psql -h 127.0.0.1 -p 5432 -U <administrator> postgres); peer authentication over the Unix socket maps to the service user only.
GET/PUT /settings/network-access (kingres_admin) holds the ordered rule list that kingresd renders into pg_hba.conf on every server. PUT replaces the whole list and needs the current revision (409 otherwise). Rules between cluster members are added by the system and cannot be removed. A rule set that would lock out the caller's own address is refused with 422; dryRun=true checks without changing anything. Replication connections for kingres-pg_basebackup need a replication rule here.
GET/PATCH /settings/cluster: defaultReplicaCount (0 to 3; a change starts the task standby.reconcile), defaultDurability, autoFailover (enabled, timeoutSeconds 30 to 3600, maxCount, eventsSinceReset; reset with POST /settings/cluster/auto-failover/reset), rebalance (strategy, threshold, automatic mode and more), features (sharding and the ledger can be enabled, never disabled again), clock.maxDifferenceMs (default 1000), analytics.allowNonSuperuserOwners (default false), dataTransfer (CSV table transfer; off by default) and restart. See High Availability and Configuration.
All of this is in the Servers, Databases, Security and Settings pages of the Web Console. A rule the role may not use is disabled with its reason.
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