Skip to content

Instantly share code, notes, and snippets.

View rodneytamblyn's full-sized avatar

Rodney Tamblyn rodneytamblyn

View GitHub Profile
@rodneytamblyn
rodneytamblyn / .bash_aliases
Last active March 24, 2022 10:13
docker cassandra graceful shutdown and safe restart
alias shutdown="cass-gracefulStopDatabase-and-reboot"
@rodneytamblyn
rodneytamblyn / backup-docker-cassandra.sh
Created March 23, 2022 23:23 — forked from tobert/backup-docker-cassandra.sh
Quick & dirty cassandra-in-docker backup script
#!/bin/bash
# A quick & dirty backup script for Cassandra running inside Docker.
# Assumes /var/lib/cassandra is mounted in the container as /var/lib/cassandra because
# docker inspect {{ .Volumes }} is not shell-friendly. (doable, but meh)
# Also assumes Cassandra was started with 'docker run --name cassandra'.
export PATH=$PATH:/home/atobey/bin:/usr/local/bin
set -e
//READ nodetool snapshot documentation in cassandra
//READ stack-overflow-topic gist or directly in stackoverflow -> http://stackoverflow.com/questions/25465904/how-can-i-restore-cassandra-snapshots
//EXPORT the databases schemas
cqlsh -e "DESCRIBE SCHEMA" > my_backup_name.schema
//Create snapshot of the whole server
nodetool snapshot my_backup_name
//Compress the backups