The sys admin's daily grind: parallel SSH

Mass Start

Author(s):

Parallel SSH is the name of an easy-to-configure tool that our resident sys admin, Charly, now routinely deploys whenever he needs to launch the same programs, copy the same files, or kill the same processes simultaneously on multiple computers.

I am writing from a Linux seminar in the Linuxhotel in Essen, Germany. The environment here comprises four Xen virtualized machines. Identical changes to all cluster nodes are a regular requirement, which is a pain, but I have a utility up my sleeve: parallel SSH [1]. Pssh relies on the SSH agent running, so I'll take care of that first:

ssh-agent
ssh-add

After I enter the pass phrase for my SSH key, the AAH agent ensures that nobody will ask me for it, at least not during the current session. Next, I need a text file in which I add the IP addresses of the servers for which I need to set up simultaneous connections, so I'll start by adding three addresses to server.txt:

192.168.5.12
192.168.5.52
192.168.5.67

First, I will open an SSH connection to these three computers, run the uname command on them, and redirect the output to my pssh-out directory with the command line:

pssh -h server.txt -l charly -o /home/charly/pssh-out uname

Now I have three files below /home/charly/pssh-out named after the server IP addresses. And lo and behold, the files contain the uname command output (Figure 1). Pssh is thus similar to the Distributed Shell (DSH).

Figure 1: Pssh launches the same example program, uname, on each machine with an entry in the server.txt list.

Two Hard-Hitting Tools

PSCP and PNuke, which are also part of the pssh package, work along the same principle.

PSCP copies files simultaneously to multiple target machines. This command adds a new message of the day to my servers:

pscp -h server.txt -l charly /etc/motd /etc/

PNuke sends a kill -9 to identically named processes on three servers

pnuke -l server.txt -l charly wget

and terminates any wget processes running on them. This frees up some bandwidth.

Conclusions

Brilliant. The most difficult thing about the pssh suite is saying its Internet page name, theether.org, without tripping over your own tongue.

Infos

  1. Parallel SSH: http://www.theether.org/pssh/

The Author

Charly Kühnast is a Unix operating system administrator at the Data Center in Moers, Germany. His tasks include firewall and DMZ security and availability. He divides his leisure time into hot, wet, and eastern sectors, where he enjoys cooking, fresh water aquariums, and learning Japanese, respectively.

Read full article as PDF:

063-063_charly.pdf  (131.91 kB)

Related content

  • Charly’s Column: Cluster SSH

    Charly doesn’t relish the idea of searching through the logfiles of a dozen proxy servers when page requests fail. Now that he has deployed Cluster SSH, he can pull the strings on many machines at the same time.

  • Charly's Column

    Who has the longest uptime? Linux systems used to win hands down when it comes to maximum uptime without rebooting. Today, uptime statistics help admins with monitoring tasks and discovering tricky bugs.

  • Charly's Column

    The siege of Troy is said to have taken 10 years, ending only after Odysseus introduced a wooden horse into the mix. Charly is planning a siege, too, and the target is his own web server. Of course, he doesn't have 10 years to complete the task, and Odysseus isn't on his team.

  • Charly's Column

    Network monitors are a dime a dozen, but Nload, which separates incoming and outgoing traffic and draws graphs on the console without X, is unique.

  • Charly's Column

    Well-used services write reams of log information to disk, which is not only bothersome from a storage perspective but also pushes grep and the usual group of statistics tools to their limits. Will hitching the syslog daemon up to a database help?

comments powered by Disqus

Direct Download

Read full article as PDF:

063-063_charly.pdf  (131.91 kB)

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia