Skip to content

Instantly share code, notes, and snippets.

@mshuler
Created August 28, 2015 17:54
Show Gist options
  • Save mshuler/17e8eaa1cd0bd8a9e331 to your computer and use it in GitHub Desktop.
Save mshuler/17e8eaa1cd0bd8a9e331 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# stop manually started cassandra service, remove dtest cruft,
# and wipe data and logs
#
# set user or leave commented out for current user from env
#USER=cassandra
# set REPODIR to the git checkout, so we can clean 2.1+ data/logs
REPODIR=$HOME/git/cassandra
# kill all CassandraDaemon processes
while pgrep -f CassandraDaemon; do
pkill -f CassandraDaemon
echo "..SIGTERM sent"
sleep 2
done
echo "no CassandraDaemon.."
# clean up after unit tests..
# snazy's line:
# rm -rf cassandra* ks-cf-ib-1-* readtest* set_negative_length* StreamingTransferTest* Standard* Statistics.db* SSTable* KeyStreamingTransferTestSpace* Keyspace* DescriptorTest* Counter* CFWith* +~* ValuesWithQuotes* lengthtest* 142* lib_ohc-core-* snappy-* jna-*
rm -rf /tmp/14*-0 /tmp/CFWith* /tmp/Counter1* /tmp/DescriptorTest* /tmp/Keyspace1* \
/tmp/KeyStreamingTransferTestSpace* /tmp/SSTableExportTest* /tmp/SSTableImportTest* \
/tmp/Standard1* /tmp/Statistics.db* /tmp/StreamingTransferTest* /tmp/ValuesWithQuotes* \
/tmp/cassandra* /tmp/cql_keyspace* /tmp/jna*.tmp /tmp/ks-cf-ib-1-* /tmp/lengthtest* \
/tmp/liblz4-java*.so /tmp/libnetty*.so /tmp/readtest* /tmp/set_length_during_read_mode* \
/tmp/set_negative_length* /tmp/snappy-*.so /tmp/testMark* /tmp/testReadBytes* /tmp/testReadFully* \
/tmp/testSkipCache* /tmp/testTruncate* /tmp/tmp*.json
# remove remnant dtest temporary dirs
find /tmp/ -maxdepth 1 -user $USER -type d -name dtest-* -exec rm -r {} \;
# set up fresh /var/{lib,log}/cassandra dirs
sudo rm -r /var/lib/cassandra /var/log/cassandra
sudo mkdir /var/lib/cassandra /var/log/cassandra
sudo chown $USER /var/lib/cassandra /var/log/cassandra
# set up fresh 2.1+ data/logs dirs
rm -rf $REPODIR/data $REPODIR/logs
echo "this house is clean.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment