DSH - dancer's shell / distributed shell
What is dsh
dsh is an implementation of a wrapper for executing multiple remote shell (rsh/remsh/ssh) commands. rsh/remsh/ssh are wrappers for executing shell (ksh/bash/zsh/tcsh/sh .. etc... ) on remote hosts.
A note on 'security hole'
The security advisory that was posted on bugtraq on 10 Aug 2003 does not affect any operating system that provides asprintf function. That means Debian is not vulnerable, since most Linux distributions use glibc that provides asprintf function.
After checking asprintf function provided by dsh, it is not vulnerable either. I could not make it crash. You can check yourself with "make check" to see if the security hole actually exists on your platform (test-bufferoverflow.sh). Tested on HP-UX. 26 Aug 2003, 0.24.2
Aim
On systems like UNIX-based cluster systems, there are many cases which the same command needs to be ran on multiple hosts. To write such a script is one of the first things that a system administrator of such system does. However, writing the script again and again on each system is inefficient and boring. Thus, the author, who maintains many Debian based systems have looked for a generic script that is available for the wide public, but there were none that worked satisfactory (at that time). Thus, the program that has been written for personal use has been polished to become more generic, and it was released to the public, so that the program can be installed from any mirror around the World, where it is easy to obtain from any on-sight maintenance locations. It was desired that the application that is known to work can be obtained from a convenient place.
Reality
A simple was produced, and with some techniques, a fast distributed processing could be done. Hierarchical invocation technique is implemented. Accessing to 4 nodes, and the 4 nodes accessing 4 nodes each to accomplish 16-node run in a very efficient manner was implemented. Configuration files are in text-based structure, and with a machine list given, rsh and ssh programs can be executed against each of the nodes, using the dsh command.
Just for the sake of it, using a window of connection is supported. It is to use specific amount of connections at any one time to limit resource usage. dsh -c will use up the Linux default system resource pretty quickly at about 200 hosts. dsh -F 200 will be much more friendly.
Results
It is now installed on many clusters, and program is conveniently executed. The use is not restricted to clusters either. Currently, dmachinemon system uses the dsh command extensively. This version of dsh is implemented in C.
Download
The source is available from the Download area. Binaries are available from vendors such as Debian.
It is possible to use Netgroup information with dsh (information provided by services such as NIS).
Recent dsh requires libdshconfig. Please take that package as well.
How to compile
This method is for people who are not using Debian, and need to compile. First compile libdshconfig, and install.
$ tar xfz libdshconfig*.tar.gz;
$ cd libdshconfig-*
$ ./configure ; make
# make install
Then compile dsh and install.
$ tar xfz dsh*.tar.gz
$ cd dsh-*
$ ./configure ; make
# make install
Currently the compilation is verified on AIX, Solaris, Cygwin, MacOSX, HP-UX 11.22, Tru64 Unix systems (does not pass test), as well as Linux.
Configuration
/etc/dsh/machines.list or ${sysconfdir}/machines.list has the data used for list of machines. Please write the list of machines on this file.
Putting file matching the group name at ${HOME}/.dsh/group/group-name will enable command execution for list of hosts on the file.
Usage
Doing dsh -a -c -- uname -a will execute programs on every single node listed in the configuration file.
Doing dsh -g children -c -- uname -a will execute programs on group "children", which is specified in ${HOME}/.dsh/group/children
dsh now supports netgroups, which is available under systems such as NIS, and it can be used like: dsh -g @nisgroup -- uname -a
For more usage, please see dsh.1
Related Works
I didn't really know about their existence when I started out this project, but similar projects do exist. Some are less maintained than the other, some are less portable than the other.
* dsh 2.0 in perl dsh 1.0 in perl
* dsh in C
* dsh in C command-line compatible with dsh for RS/6000
* dsh in python? need more info
The original implementation of 'dsh' that most applications are based upon seem to be on AIX.
References
Reports
* (Japanese)Taniguchi "evaluation of dsh as a basis of DNAS system" 52th Monthly Lecture Meeting, 2002 PPT resumé
* (Japanese)Taniguchi "dsh" 7th research report, 2002
阅读(642) | 评论(0) | 转发(0) |