cssh

In this post, I will introduce you to cluster administration tool called clusterSSH (cssh)

cssh is an abbreviation for clusterSSH.  Normally ssh connection to a host is established by supplying  host name.  What if, you have to log in to many machines simultaneously. Definitely you could do one by one, but that is not the programmer way of doing things.  cssh  is an open source tool written in perl on top of ssh to log in to multiple machines simultaneously. cssh is available for linux, mac and solaris operating systems. cssh establishes individual ssh connection to all the machines and opens individual X-term window for each machine and it also opens an administrative console. The administration console can be used to send commands to all machines to which connection is established. Commands can also be run on individual machines by selecting a particular Xterm window.  cssh can be useful in various cases. It can be used to send the same command to all machines in a cluster at the same time. It can be used for debugging by tailing logs of all machines under the load balancer.

Open source page : http://sourceforge.net/projects/clusterssh/

Installation :

Ubuntu
 sudo apt-get install clusterssh (through apt)

Mac : cssh is available as csshx (https://code.google.com/p/csshx/)

( or)

  • Download the later .gz file
  • gunzip <filename.tar.gz>
  • tar -xvf filename.tar

you will find cssh excecutable inside the folder

Usage and examples :

cssh to 4 machines will look like

cssh-example

 

cssh <list of hostnames> eg.., cssh 1@aa.com 2@bb.com 3@cc.com

Custom tags can be defined in  /etc/clusters  in  format :

<tag> [user@]<server> [user@]<server> [...]

eg :  remote 1@11.com 2@22.com

cssh remote

 will expand to

cssh 1@11.com 2@22.com

The options can be overridden in  /etc/csshrc or $HOME/.csshrc file.

Thanks,

Kirubs.