23. November 2010 · 1 comment · Categories: Linux

SSH on multiple servers using Cluster SSH

If you had to make the same change on more than one Linux/Unix server, e.g a backup, restore or something else, well ClusterSSH is a tool that solve this problem. It’s painful to keep repeating the exact same commands again and again… so Cluster SSH opens terminal windows with connections to specified hosts and an administration console. Any text typed into the administration console is replicated to all other connected and active windows. This tool is designed for cluster administration where the same configuration or commands must be run on each node within the cluster, in this way all nodes are kept in sync.

It’s easy to install it … on Ubuntu you just have to type:

[pensacola@pensacola-tech ~]# apt-get install clusterssh

To configure this you have to edit /etc/clusters file. Contains a list of tags and hostnames, in the form:

<tag> [<username>@]hostname [...]

Basically if you want to perform the same command on the three servers: server1, server2, and server3 you have to use the following command:

[pensacola@pensacola-tech ~]# cssh server1 server2 server3

This will open three consoles, one for each server, over an ssh connection, and one little console to type your command.