Cluster SSH

Have a handful of servers you need to perform the same commands on, e.g., keeping their software packages up to date using aptitude:


aptitude update && aptitude safe-upgrade && aptitude clean

So, you’re performing the same procedure on each host: logging in, executing aptitude, logging out… But WAIT! There’s Cluster SSH for you. 😀

The idea is simple: type in a command into one console and multiplex that input to several remote, i.e., SSH sessions.

For Mac OS X, csshX (also available as homebrew formula) comes in handy as it provides that multiplexing support for Terminal.app.

ClusterSSH

Open a console in Terminal.app and type in

csshX user1@host1 user2@host2 user3@host3 …

(providing appropriate user@host combinations for your needs, of course).

Then, you enter your commands, e.g., aptitude update into the red control console. As you can see in the screenshot, the keystrokes are the sent to all open shells. Updating a bunch of servers became… a piece of cake. Hooray for the lazy admin!

4 thoughts on “Cluster SSH”

  1. csshX is so awesome. I just recently started using it, since I have a few clusters that need to be identically configured. I use puppet for most configuration, but every now and then when I want to tail logs on all at once or even force a puppet run on all of them.. I have scripts that do ssh for loops, but the csshX option is very awesome, especially because it supports regexes in the hostnames… csshX -l jabba clusterhost[01-25].domain.tld will open up all 25 hosts (caution: good to have a big monitor for anything more than about 6 hosts). I think I really just saved myself an hour each day of typing login and logout commands alone..

  2. My favorite usage of csshX is with zsh expressions; if you’ve got a few campuses with a few switches at each, you can do “csshX {c1,c2}ss{1,2,3,4}” to ssh into each of the four storage switches at two campuses (for a total of eight windows). Do this often enough and you might be able to convince someone that you need more pixel real estate and get a monitor upgrade. 😉

Leave a Reply

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