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.


1 Comment

  1. ClusterSSH is a great tool for what it’s supposed to be (a fancy SSH loop), but sometimes you just need more than that. For those cases, there are dedicated tools such as MCollective, which is much more powerful, and very performant for huge clusters(works instantaneously for even more than 1000 nodes).

    I used clusterSSH a lot on clusters of ~10-15 nodes, but most of the times I ended up executing commands that had to do with system configuration. For such cases it’s just better not to make the configuration on the target machine, but to declare/manage it from a central host, using a configuration management tool, such as Puppet(or cfengine, etc). This way the configuration will be maintained automatically in a consistent state across all the environment, and it totally worths the effort.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

css.php