Created
October 28, 2015 11:41
-
-
Save IcaroBichir/45a3c8d06d8e48811cd2 to your computer and use it in GitHub Desktop.
Script to restore cassandra backuped files from snapshot directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -ex | |
sudo find /home/ubuntu/backup-000/oldCluster -type d -exec chmod 755 {} + | |
sudo find /home/ubuntu/backup-000/oldCluster -type f -exec chmod 644 {} + | |
sudo chown -R cassandra:cassandra /home/ubuntu/backup-000/oldCluster | |
sudo rm /var/lib/cassandra/commitlog/*.log | |
sudo rm -rf /var/lib/cassandra/data/system/* | |
sudo rm -rf /var/lib/cassandra/data/system_traces/* | |
sudo cp -avr /home/ubuntu/backup-000/var/lib/cassandra/data/{keyspace} . | |
++++++++++ | |
#! /bin/bash -ex | |
dir=$(pwd) | |
for keyspaces_dir in "{keyspace]" ; do | |
cd $keyspaces_dir | |
ls | while read directory; do | |
cd $directory | |
set +e | |
sudo rm *.db | |
set -e | |
ls snapshots/full-000 | while read file; do | |
sudo cp -avr snapshots/full-000/$file . | |
done | |
sudo rm *.json | |
cd $dir/$keyspaces_dir | |
done | |
cd $dir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment