[CentOS] question on managing multiple boxes

Tue Aug 4 19:45:15 UTC 2009
nate <centos at linuxpowered.net>

Jerry Geis wrote:
> How do admins handle a situation with many boxes like 50 for example.
> If I wish to tell 50 boxes to run a handful of commands - how is that done?
> (I mean without actually logging into 1,2,3,4...X  and executing the
> commands)

Depends what the commands have to do. For most of my management I use
cfengine which runs hourly and can run things on classes of boxes.

If I want to run something *right now* I use a simple script and
ssh keys, and ssh-agent to automatically login to however many boxes
I want and run the command.

e.g. assuming the boxes have various names, create a text file that
has all of their names and a simple 1-liner to iterate through the
file and login to the systems, if they are all named similarly you
can use something like seq to help

e.g.

for i in `seq -w 1 50`; do ssh username at myserver${i} "my command";done

There are also tools like clusterssh which can run the commands
in parallel. Never used them myself.

nate