ClusterSSH – working with many servers at once

Often, we find ourselves repeating the same configuration steps to our servers again and again.  Consistency in these configuration steps can be essential and yet, many times we make mistakes or accidentally leave a step out moving from one server to the next.

ClusterSSH (cssh) has been a very handy tool for dealing with this.  Cssh allows you to open multiple terminal consoles to different servers.  Once the connections are made, you can send the same command to each console allowing for control of multiple servers simultaneously.  There is also the Mac OS X version of cssh called csshx that comes in handy for those of us who are Apple-fans.  No sight of a version for Windows so far…

Getting cssh on my Ubuntu workstation was very simple, just run sudo apt-get install clusterssh to install.  A handy trick with cssh is to utilize local configuration options to retain lists of servers and aliases for cssh targets.  For instance, one could easily configure a line for apache_servers with the pertinent IPs or hostnames for the servers you wanted to reach.

Create a file called .cssh-clusters within your home directory and add the following line example to it:

apache_servers  username@192.168.1.100  username@192.168.1.101  username@192.168.1.102

Once this file has been created, you can connect to the three servers using the alias with cssh apache_servers.  This makes repeated access to the same group of servers very flexible to setup and re-use.

About Ben Shum

Ben Shum (bshum) is the Open Source Software Coordinator for Bibliomation, a consortium of public and school libraries in Connecticut that implemented Evergreen ILS in 2010.

3 Responses to ClusterSSH – working with many servers at once

  1. Pingback: Favourite new website: Library Hackers Unite! « mmit blog