Tuesday, July 4, 2017

Run same command in Cassandra Cluster

To run same command on a cluster of Cassandra database.

1) Install sshpass on any of the node running Ubuntu, by doing
sudo apt-get install sshpass

2) Run this as a shell script

for value in 'nodetool status | grep -E "x[.]y[.]z*" | awk '{print $2}''
do
   echo $value
   sshpass -p 'password' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null username@value -C "nohup nodetool repair > /dev/null 2>&1 &"
done

No comments:

Post a Comment