System table exporter¶
CFR’s sys-export
and sys-import
commands support collecting and analyzing
information about CrateDB clusters for support requests and self-service
debugging.
Install¶
pip install --upgrade 'cratedb-toolkit[cfr]'
Tip
Alternatively, use the Docker image per ghcr.io/crate/cratedb-toolkit
.
For more information about installing CrateDB Toolkit, see Installation.
Synopsis¶
Define CrateDB database cluster address using the CRATEDB_CLUSTER_URL
environment variable.
export CRATEDB_CLUSTER_URL=crate://localhost/
Export system table information into timestamped file, by default into the
current working directory, into a directory using the pattern
cfr/{clustername}/{timestamp}/sys
directory.
ctk cfr sys-export
Import system table information from given directory.
ctk cfr sys-import file://./cfr/crate/2024-04-18T01-13-41/sys
Usage¶
Target and source directories¶
The target directory on the export operation, and the source directory on the import operation, can be specified using a single positional argument on the command line.
Export system table information into given directory.
ctk cfr sys-export file:///var/ctk/cfr
Import system table information from given directory.
ctk cfr sys-import file:///var/ctk/cfr/crate/2024-04-18T01-13-41/sys
Alternatively, you can use the CFR_TARGET
and CFR_SOURCE
environment
variables.
CrateDB database address¶
The CrateDB database address can be defined on the command line, using the
--cluster-url
option, or by using the CRATEDB_CLUSTER_URL
environment variable.
ctk cfr --cluster-url=crate://localhost/ sys-export
OCI¶
If you don’t want or can’t install the program, you can also use its OCI container image, for example on Docker, Postman, Kubernetes, and friends.
Optionally, start a CrateDB single-node instance for testing purposes.
docker run --rm -it \
--name=cratedb --publish=4200:4200 --env=CRATE_HEAP_SIZE=4g \
crate/crate:nightly -Cdiscovery.type=single-node
Define the database URI address, and an alias to the cfr
program.
echo "CRATEDB_CLUSTER_URL=crate://localhost/" > .env
alias cfr="docker run --rm -it --network=host --volume=$(PWD)/cfr:/cfr --env-file=.env ghcr.io/crate/cratedb-toolkit:latest ctk cfr"
Export system table information.
cfr sys-export
Import system table information.
cfr sys-import cfr/crate/2024-04-18T01-13-41/sys