Skip to content

Instantly share code, notes, and snippets.

@zseta
Last active April 21, 2024 12:58
Show Gist options
  • Save zseta/baf3255de957f41cb10b85296c0c5d10 to your computer and use it in GitHub Desktop.
Save zseta/baf3255de957f41cb10b85296c0c5d10 to your computer and use it in GitHub Desktop.
ScyllaDB docker cheat sheet

create new one-node cluster

docker run -d --name scylladb-demo -d scylladb/scylla

create new three-node cluster

docker run --name scylla-demoA -d scylladb/scylla:5.2.0 --overprovisioned 1 --smp 1
docker run --name scylla-demoB -d scylladb/scylla:5.2.0 --overprovisioned 1 --smp 1 --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' scylla-demoA)"
docker run --name scylla-demoC -d scylladb/scylla:5.2.0 --overprovisioned 1 --smp 1 --seeds="$(docker inspect --format='{{ .NetworkSettings.IPAddress }}' scylla-demoA)"

fetch status of cluster

docker exec -it scylla-demoA nodetool status

It might take a couple of minutes until all nodes start up

get ip address of cluster

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' scylladb-demo

connect to scylladb

Install cqlsh (the scylladb version) - you need python for this: pip install scylla-cqlsh

cqlsh 172.17.0.2

switch to a keysapce: USE some_keyspace

export data

export schema:

docker exec -it scylladb-demo cqlsh -e "DESC SCHEMA" > export_schema.cql

export data to CSV:

cqlsh -u scylla -p <password> 172.17.0.2
COPY keyspace.table TO './export.csv' WITH HEADER=TRUE;

import data

create schema from file:

cqlsh 172.17.0.2 -u scylla -p x -f ./db_schema.cql 

import data from CSV:

cqlsh -u scylla -p <password> 172.17.0.2
COPY keyspace.table FROM './data.csv' WITH HEADER = TRUE;

Might need to specify the column names as well.

experiemantal features

yaml file location: /etc/scylla/scylla.yaml

enable UDF:

experimental_features:
     - udf

enable_user_defined_functions: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment