Parallel SSH

Parallel SSH is a useful tool designed to run a command on multiple servers in parallel. An advantage of PSSH over some alternatives (like DSH) is the manner outputs are stored: all outputs are sent to a folder containing an output file per server.

Using PSSH

First create your servers list, using the syntax host:port user :

vi /tmp/hosts_list.txt
server1
server2
server3:2222 foobar

Then create two directories: one for standard outputs, the second for error outputs.

mkdir /tmp/output
mkdir /tmp/error

Then execute your command:

parallel-ssh -h /tmp/hosts_list.txt -o /tmp/output/ -e /tmp/error/ uptime

Further Reading and sources

Leave a Reply

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