Extract Schema from system table¶
The first step in restoring a Scylla Manager backup is restoring the CQL schema from a text file. But what if the schema is not available? Luckily, the schema is also stored in the Scylla system table, so in case you have a backup of the system keyspaces, you can extract it from there.
The following step, download the system_schema
backup file, mount it to a Scylla Docker and extract the schema. Once you have the schema file, you can go back to the standard restore procedure.
Follow these steps to restore the schema from the Manager backup:
List available backups:
sctool backup list --cluster my-cluster
List files of snapshot we want to restore (replace <node_id> with ID of one of the nodes in the cluster
sctool backup files --cluster my-cluster -T sm_20200513104924UTC -K system_schema --with-version | grep "<node_id>" > backup_files.out
Create a directory, and recreate table directories in it
mkdir scylla cd scylla cat ../backup_files.out | awk '{print $2}' | sort | uniq | xargs mkdir -p
Download the SSTables to the created directories
cat ../backup_files.out | xargs -n2 aws s3 cp cd ..
Start the Scylla container with mounted data volume. Make sure to use the same Scylla version used to create the backup (in the example
4.0.0
)docker run --name scylla:4.0.0 -p 9042:9042 -v `pwd`/scylla:/var/lib/scylla/data --memory 1G --rm -d scylladb/scylla:latest
Extract schema:
cqlsh 127.0.0.1 -e "describe schema" > db_schema.cql
You can now use db_schema.cql
to continue the restore procedure