A very useful tool in cluster environment

Distributed Shell (dsh) is a very powerful tool for system administrators in a cluster environment. Here are some tips for installing and using it:

sudo apt-get install dsh

or

sudo yum install dsh

In /etc/dsh/dsh.conf change remoteshell:

remoteshell =ssh

Here is how to make your public key if you do not have one yet (~/.ssh/id_rsa.pub)

$ ssh-keygen -t rsa -P “”
(no passphrase , ~/.ssh/id_rsa.pub will be created )
$ ssh-copy-id -i ~/.ssh/id_rsa.pub   ALL_OTHER_HOSTS

Then in /etc/dsh/machines.list  put all your hosts:

192.168.1.10

192.168.1.11

192.168.1.12

192.168.1.13

 

Finally you can issue commands to ALL the hosts in your cluster:

$ dsh –aM –c YOUR_COMMAND

For example:
$ dsh –aM –c uptime