Friday, June 26, 2015

Start-up script for an installed Apache Zookeeper Cluster

If you have an installed Zookeeper-3.3.5 cluster, this script will save you from manually visiting each node and starting the zkServer there. All you have to do is grab a remote machine and run the script. The script will ask for the required information and your cluster would be up. Also, the script should work equally fine for both Ubuntu and CentOS.


# Directory Name
echo "Enter the zookeeper setup location :"
read -e zookeeperSetupLocation

# Read the ips and the usernames of all the machines in the zookeeper cluster
echo "Enter the number of machines in the cluster";
read -e n;
for ((  i = 1 ;  i <= n;  i++  ))
echo "Enter the IP of cluster machine $i:"
read -e zkServer;
echo "Enter the username of machine ${zkServerIPs[i]}"
read -e username

# Start up the cluster
for ((  i = 1 ;  i <= n;  i++  ))
ssh ${zkServerUsernames[i]}@${zkServerIPs[i]} "$zookeeperSetupLocation/zookeeper-3.3.5/bin/ start;"

Thanks !!

No comments:

Post a Comment