Skip to content

Instantly share code, notes, and snippets.

@RobinUS2
Created December 1, 2015 13:16
Show Gist options
  • Save RobinUS2/164a71e8ca43f92f0566 to your computer and use it in GitHub Desktop.
Save RobinUS2/164a71e8ca43f92f0566 to your computer and use it in GitHub Desktop.
Force cassandra node to join ring after bootstrap failures
#!/bin/bash
# In case a join keeps failing to join the ring but you really want to force it (use with caution), you can do the following
# 1: Shut down node
service cassandra stop
# 2: Backup data
mkdir -p /backup/cassandra/data/system/local
cp -r /var/lib/cassandra/data/system/local/* /backup/cassandra/data/system/local
# 3: Export the local schema as ss table
# Replace <NUMBER_HERE> with an integer value containing the IN_PROGRESS value of the status
# If you have multiple tables the value is likely in the first one with the lowest number
cd /var/lib/cassandra/data/system/local/
sstable2json system-local-jb-<NUMBER_HERE>-Data.db > system-local-jb-<NUMBER_HERE>-Data.json
# 4: Now open the file with your favorite editor and modify the IN_PROGRESS to COMPLETED
# 5: Convert the JSON table into an SS table
rm system-local-jb-<NUMBER_HERE>-Data.db
json2sstable -s -K system -c system-local-jb-<NUMBER_HERE>-Data.json > system-local-jb-<NUMBER_HERE>-Data.db
# 6: Fix permissions
chown cassandra:cassandra *
# 7: Start cassandra
service cassandra start
# In case this still doesn't work, repeat all steps about, but also remove the contents of /var/lib/cassandra/commitlog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment