Clusterssh – Administer multiple ssh or rsh shells simultaneously
This tool is intended for (but not limited to) cluster administration where the same configuration or commands must be run on each node within the cluster. Performing these commands all at once via this tool ensures all nodes are kept in sync.
Connections are opened using ssh which must be correctly installed and configured.
Extra caution should be taken when editing files as lines may not necessarily be in the same order; assuming line 5 is the same across all servers and modifying that is dangerous. It's better to search for the specific line to be changed and double-check all terminals are as expected before changes are committed.
Install clusterssh on ubuntu 21.04
Open the terminal and enter the following command
sudo apt-get install clusterssh
Clusterssh Examples from command line
Open up a session to 3 servers
$ cssh server1 server2 server3
Open up a session to a cluster of servers identified by the tag ‘farm1'and give the controlling window a specific title, where the tag is
defined in one of the default configuration files
$ cssh -T ‘Web Farm Cluster 1' farm1
Connect to different servers using different login names. NOTE: this can also be achieved by setting up appropriate options in the configuration files. Do not close the console when the last terminal exits.
$ cssh user1@server1 admin@server2
Open up a cluster defined in a non-default configuration file
$ cssh -c $HOME/cssh.extra_clusters db_cluster
Override the configured/default port to use 2022 instead
$ cssh -p 2022 server1 server2