Installing pdsh to issue commands to a group of nodes in parallel in CentOS


1. What is pdsh?

Pdsh is a high-performance, parallel remote shell utility. It uses a sliding window of threads to execute remote commands, conserving socket resources while allowing some connections to timeout if needed. It was originally written as a replacement for IBM’s DSH on clusters at LLNL. More information can be found at PDSH Web site

2. Setup EPEL yum repository on CentOS 6.

For more information, see Repository of CentOS 6 and Scientific Linux 6

3. Do a yum install

# yum install pdsh

To confirm installation

# which pdsh

4. Configure user environment for PDSH

# vim /etc/profile.d/pdsh.sh

Edit the following:

# setup pdsh for cluster users
export PDSH_RCMD_TYPE='ssh'
export WCOLL='/etc/pdsh/machines'

5. Put the host name of the Compute Nodes

# vim /etc/pdsh/machines/
node1
node2
node3
.......
.......

6. Make sure the nodes have their SSH-Key Exchange. For more information, see Auto SSH Login without Password
7. Do Install Step 1 to Step 3 on ALL the client nodes.


B. USING PDSH

Run the command (  pdsh [options]… command  )

1. To target all the nodes found at /etc/pdsh/machinefile. Assuming the files are transferred already. Do note that the parallel copy comes with the pdsh utilities

# pdsh -a "rpm -Uvh /root/htop-1.0.2-1.el6.rf.x86_64.rpm"

2. To target specific nodes, you may want to consider using the -x command

# pdsh -x host1,host2 "rpm -Uvh /root/htop-1.0.2-1.el6.rf.x86_64.rpm"

References

  1. Install and setup pdsh on IBM Platform Cluster Manager
  2. PDSH Project Site
  3. PDSH Download Site (Sourceforge)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s