Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50628 views
#!/usr/bin/env bash

NAME=`date +"%Y-%m-%dT%H%M%S"`
mkdir -p $NAME

echo "Dumping critical data"

echo "Dumping accounts..."
time echo "select * from accounts limit 1000000;" | cqlsh_connect 10.1.1.2 > $NAME/accounts
echo "Dumping email_address --> accounts mapping"
time echo "select * from email_address_to_account_id  limit 1000000;" | cqlsh_connect 10.1.1.2 > $NAME/email_address_to_account_id 
#echo "Dumping projects table..."
#time echo "select * from projects limit 1000000;" | cqlsh_connect 10.1.1.2 > $NAME/projects
echo "Dumping storage topology..."
time echo "select * from storage_topology limit 1000000;" | cqlsh_connect 10.1.1.2 > $NAME/storage_topology

echo "Got this:"

ls -lh $NAME

echo "Taring it all up..."
time tar jcvf "$NAME.tar.bz2" "$NAME"


echo "Encrypting the tarball for safe offsite storage"
openssl aes-128-cbc -in $NAME.tar.bz2 -out $NAME.tar.bz2.ssl

echo "You should delete $NAME after confirming it looks good."
echo "rm -rf $NAME"