
Here are the steps I followed to get my dev instance of cassandra copied to a new server (both single node instances)
I’ve used medusa tool for the same. You can read more about it here
Installation
Install medusa on both source and destination cassandra-servers, by running the following commands on both –
curl -1sLf 'https://dl.cloudsmith.io/public/thelastpickle/medusa/setup.deb.sh' | sudo -E bash sudo apt update sudo apt-get install cassandra-medusa
Export Data from Source DB
#ssh into source server and do these
mkdir ~/cassandra-bkup
sudo cp /etc/medusa/medusa-example.ini /etc/medusa/medusa.ini
sudo vi /etc/medusa/medusa.ini
# Search for, and set these values in the ini file
storage_provider = local
base_path = /home/{username}/cassandra-bkup
# Save and Exit
medusa backup --backup-name=dev-db-data --mode=full
#compress output folder
tar -czf dev-db-bkup-tar ~/cassandra-bkup
# SCP the backup directory to destination server
scp -r -i <key-file> dev-deb-bkup-tar {dest-user}@{dest-server}:~/
Import data in Target DB
# ssh into target serer and do these
tar -xzf dev-deb-bkup-tar
ls ls /home/{username}/cassandra-bkup/cassandra_backups/
#note down the folder name parallel to the folder index, let it be {sourceHostLocalName}
sudo /etc/hosts
#add an entry with local nodes IP and host name as {sourceHostLocalName}.
#You can remove this later
# save /etc/hosts and Exit Vim.
sudo medusa restore-node --keyspace={keyspace of intereset} --backup-name=dev-db-data
Verify Imported data
cqlsh {targetNodeIp}
desc keyspaces #verify you have the source keyspace created
use {keyspaceOfInterest}
desc tables; #verify all your tables in the source are recreated here.
That’s it. You should now be able to work with your new Cassandra node!

Sreekumar (KJ) has been a hobby programmer from school days. Codemarvels is his personal blog from the year 2010, where he writes about technology, philosophy, society and a bit about physics.
He now runs a conversational AI company – DheeYantra – focusing his efforts to help businesses improve operational efficiency using digital employees powered by AI.
Leave a Reply