5

I'm just wondering if there is any fellow sysadmin with the need to execute one command on multiple servers. If so, what technique are you using?

I have grown tired to ssh-ing to 3-5 servers and executing the same thing over and over again, so I'm thinking to make my life easier.
Also, I think I should create keys so I don't have to enter passwords anymore (though I'm using root). After 2 years of doing this, I kind of developed a laziness.

I googled it up, I know about cssh, pssh, tentakel (this one seems cool), and the more pro-genre - Puppet (of which I just heard of, didn't invest the time to read the docs).

BTW, I'm using XP+putty, so if there is any putty-cool-thingy available, that's welcome too. If not, I can always ssh to one server and from there start my rest-of-the-servers-conquest :) *evil*

Hit me up. Thanks.

3
  • 1
    Ever heard of a batch file? May 20, 2010 at 13:51
  • that's not quite a great idea.
    – w00t
    May 21, 2010 at 7:01
  • What are you executing? How do you know it worked or had the expected result on all the servers without actually going through them one-by-one or introducing an actual management system? Things sometimes sound a bit complex for a reason (though more often for no good reason) ^^ Aug 11, 2010 at 14:59

6 Answers 6

8

Look at:
clusterssh

6
2

If you're a Ruby person then Capistrano is worth considering. If you're keen on the idea of Puppet then cfengine and bcfg2 are also worth taking a look at.

I'm really liking Capistrano for regular tasks, though I'm not sure I'm using it very well and I'd probably benefit from some training. For more one-off tasks I'd recommend clusterssh.

1
  • capistrano looks kind of complex :(
    – w00t
    May 21, 2010 at 8:20
2

Have a look at:

http://www.millardsoftware.com/puttycs

It is a wrapper around PuTTy that performs a similar function to Cluster SSH.

1
2

dssh or pssh may provide you with what you need.

2
  • Just tried pssh, it's even available by default as a package in Ubuntu (although the command is called parallel-ssh there). Works perfectly!
    – Wim
    Sep 3, 2011 at 12:44
  • Happy to hear it!
    – gWaldo
    Sep 3, 2011 at 13:50
0

If you have ssh keys setup and installed and want something simple:

#!/bin/bash
SRVLST="server1 server2"

for SRV in $SRVLST
do
    echo Logging into root\@$SRV
    ssh root@$SRV "$1"
done

However if you really want to controll things properly you should look at a utility such as Puppet

3
  • 1
    cssh and dsh do this better
    – ptman
    May 20, 2010 at 9:03
  • there are likely many many better ways to do this; it's a simple option nothing more. The preference would be to implement a system to actually control them along the lines of Puppet as mentioned in the question.
    – Antitribu
    May 20, 2010 at 9:06
  • Actually I do have a script in bash that does this for my apache-cluster: read answ com=`ssh web2 "$answ"` echo "$com" but I want to try something more efficient.
    – w00t
    May 20, 2010 at 9:52
0

If you need just to execute the same commands on a set of servers, then I would suggest clusterssh: I use it routinely and it works very well.

6
  • don't i need x-server for cluster ssh?
    – w00t
    May 21, 2010 at 8:20
  • Yes, clusterssh needs an X server, I use it on Windows boxes with Cygwin's X-Server. May 21, 2010 at 17:59
  • 1
    @sebastianopilla how many servers do you open in one session? do you have more than 10? I have two LCDs but I cannot resize the cygwin window, so I'm basically stuck to one LCD's size (17", 1280x1024) and if I want to open more sessions I cannot cram them up in there. Can you resize?
    – w00t
    Jun 18, 2010 at 12:42
  • @woot, the maximum I've done is 6, on my setup (26" main screen, 17" secondary screen) it was quite usable. I've just tried it again, and I was able to freely resize all of windows; if it doesn't work for you then there might be some issue with your Cygwin/X setup, or with clusterssh's .csshrc file. Jun 20, 2010 at 20:35
  • @sebastianopilla I was referring to the cygwin window itself, not the other windows contained in it. So the one that it is displayed in your Taskbar, can you resize that one?
    – w00t
    Jun 22, 2010 at 9:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .