4 Command Fanout

Command fanout utilities allow the system administrator to replicate shell commands across multiple systems. Traditionally, administrators have created wrappers around tools such as remote shell (see remsh(1)) and secure shell (see ssh(1)) to provide command fanout functions.

4.1 Parallel Distributed Shell

The Distributed Systems Administration Utilities (DSAU) include the open source tool Parallel Distributed Shell (pdsh). pdsh formalizes the use of remsh and ssh for distributing commands to groups of systems. Unlike remsh/ssh wrappers, pdsh offers the following benefits:

High performance

Commands are issued in parallel to groups of target system. pdsh supports a sliding window or fanout setting to control the number of concurrent commands.

Command timeout settings

pdsh supports a command execution timeout which controls how long a remote command can execute before being disconnected (to prevent problem commands from hanging). It also supports a connect timeout which prevents blocking when remote systems are unreachable.

Output processing and return status

pdsh correctly handles stdout and stderr processing and supports returning a “worst of” return status so the caller can detect errors from remote systems.

Flexible target system specifications

pdsh supports several mechanisms for specifying the target hosts on which to operate. They can be specified on the command line, on stdin, in a well known file (/etc/machines) or in a file pointed to by the WCOLL environment variable. Specific systems can be excluded from the command line as well.

Hostlist expressions

For groups of systems using a prefixNNN naming convention (for example, h1, h2, ..., hN), pdsh allows target nodes specification using hostlist expressions such as “h[1-10]” which would fan out a command to hosts named h1 through h10.

Intelligent output filtering

pdsh prefaces each line of output with the hostname of originating system. dshbak (see dshbak(8)) is a filter that can format the standard pdsh output in several different ways. The dshbak -cflag looks for output from different hosts that is identical and consolidates the output instead of duplicating it. The header will indicate the hosts to which the consolidated output applies.

Choice of command transports

pdsh can use either remote shell rcmd (see rcmd(3)) or ssh as a command transport. Note that the ssh transport offers greatly improved security. See “Security Configuration” (page 85) for details.

Parallel copy command

The pdcp command provides a parallelized copy command to copy a local source file to multiple targets.

Figure 4-1: “pdsh Architecture ”, shows the components of pdsh and its architecture.

4.1 Parallel Distributed Shell

83