pdsh and /etc/hosts

pdsh

pdsh is a shell tool that will execute a shell command on multiple nodes in quasi parallel fashion. It can be installed directly from the repositories:

sudo apt-get update && sudo apt-get install pdsh

pdsh requires keys or other passwordless authentication between nodes. To test, you can use a simple command like 'hostname' and have it execute on all nodes:

root@nano:~# pdsh -R ssh -w 10.0.0.[101-104] hostname
10.0.0.102: nano02
10.0.0.104: nano04
10.0.0.101: nano01
10.0.0.103: nano03
root@nano:~#

To avoid needing to use -R ssh with every invocation, you can set the PDSH_RCMD_TYPE environment variable to ssh:

export PDSH_RCMD_TYPE=ssh

To do this for all users, create an appropriate file under /etc/profile.d:

echo "export PDSH_RCMD_TYPE=ssh" >> /etc/profile.d/pdsh.sh

For pdcp, and for using pdsh from compute nodes rather then the master, pdsh must be installed on the compute nodes as well. This is doable using pdsh from the master node to install pdsh from the repositories onto the compute nodes.

/etc/hosts

Up until now, we have been accessing compute nodes by IP address, which can get tedious. /etc/hosts can be configured/edited using pdsh to add declarations for each compute node.

Last updated