When you are in a job that demands you handle or maintain a custer of computers. You will most likely have to do following tasks:
- execute the same set of commands to explore the state of all the machines
- run a script on all the machines
- upload files from all of the machines
- download file from all of the machines.
Here are the sets of scripts that has been helpful for me.
The script below opens the tmux ssh session on all the machines of the cluster. The shell are set in synchronization mode which means the keys you pressed applies to all the machines. The syntax that the scripts accepts is:
Usage: /usr/local/bin/multissh [-J proxy_ip] [-i input_file] [-u user] [ips ...]
The script below runs the script on all the machines as a sudo user. The syntax that the scripts accepts is:
Usage: /usr/local/bin/clusterrun [-J proxy_ip] [-i input_ips] [-o output_file] [-p password] [-u user] script [ips ...]
The script below upload files to the cluster. The syntax that the script accepts is:
Usage: clusterupload [-J ssh_proxy] [-i input_file] [-u user] src_path dst_path [ips ...]
The script below download files from the cluster and saves it in file corresponding to the ip of the machine. The syntax the the script accepts is:
Usage: usage [-J proxy_ip] [-i input_ips] [-u user] src_path dst_path [ips ...]
If you like my above script you can directly install the above tools using homebrew in mac.
brew tap shubhajeet/cluster brew install cluster
This has added bonus of the man pages so you could read the man pages if your confused with syntax of any of the above commands.