CrateDB Cluster CLI¶
The ctk cluster {start,info,stop}
subcommands provide higher level CLI
entrypoints to start/deploy/resume a database cluster, inquire information
about it, and stop/suspend it again.
The subsystem is implemented on top of the Croud CLI application, which gets installed along the lines and is used later on this page.
Install¶
We recommend using the uv package manager to install the application per
uv tool install
. Otherwise, using pipx install
or pip install --user
are viable alternatives.
uv tool install --upgrade 'cratedb-toolkit'
Authenticate¶
When working with CrateDB Cloud, you can select between two authentication variants.
Either interactively authorize your terminal session using croud login
,
croud login --idp {cognito,azuread,github,google}
or provide API access credentials per environment variables for headless/unattended
operations after creating them using the CrateDB Cloud Console or
croud api-keys create
.
# CrateDB Cloud API credentials.
export CRATEDB_CLOUD_API_KEY='<YOUR_API_KEY_HERE>'
export CRATEDB_CLOUD_API_SECRET='<YOUR_API_SECRET_HERE>'
Configure¶
The ctk cluster
subcommand accepts configuration settings per CLI options and
environment variables.
Cluster address
The program provides various options for addressing the database cluster in different situations, managed or not.
- CLI options:
--cluster-id
,--cluster-name
,--cluster-url
- Environment variables:
CRATEDB_CLUSTER_ID
,CRATEDB_CLUSTER_NAME
,CRATEDB_CLUSTER_URL
Note
All address options are mutually exclusive.
CLI options take precedence over environment variables.
The cluster identifier takes precedence over the cluster name.
The cluster url takes precedence over the cluster id and name.
Environment variables can be stored into an
.env
file in your working directory.
Usage¶
Start or resume a cluster, deploying it on demand if it doesn’t exist.
ctk cluster start --cluster-name hotzenplotz
Display cluster information.
ctk cluster info --cluster-name hotzenplotz
Stop (suspend) a cluster.
ctk cluster stop --cluster-name hotzenplotz
See also
CrateDB Cluster CLI/API Tutorial includes a full end-to-end tutorial.