dcsimg

Remote Administration with DSH

Discover dsh, a utility to run arbitrary commands on any number of remote machines.

Previous “Tech Support” columns introduced both Perlbal and Pound, two packages to load balance traffic across multiple machines. Dividing load among several servers provides better performance and increased reliability. However, more machines translates to more tedium. Previously simple actions — such as restarting a service — becomes complex.

There are multiple solutions to managing a collection of machines. One common solution is to write a custom script for each task. A more innovative solution is dsh, the “distributed shell.” dsh is a wrapper implementation to execute remote shell commands on multiple machines. dsh abstracts the problem of multiple machines and offers a general solution.

dsh is provided under the terms of the GNU Public License and can be downloaded from the dsh home page at http://www.netfort.gr.jp/~dancer/software/dsh.html.en. Before you install, download, build, and install libdshconfig, which is also available from the dsh home page.

To build and install dsh, run the standard commands:

$ ./configure 
$ make
$ sudo make install

dsh has three system-wide configuration files, and you can extend those with personal settings.

*/usr/local/etc/machines.list and $HOME /.dsh/machines.list enumerate the machines to operate upon if the –a (“all machines”) option is specified.

*/usr/local/etc/group/ groupname and $HOME /.dsh/group/ groupname define the group named groupname. To operate on a group of machines, specify –g groupname.

*/usr/local/etc/dsh.conf and $HOME/.dsh/dsh.conf set parameters for dsh.

man dsh.conf describes all of the available configuration options. Both the machines.list and the dsh group files are a list of machines, one machine name per line.

For the best security, always set remoteshell=ssh and ensure that SSH keys provide ready and automatic access between all of the machines. Depending on your environment, the remoteshellopt option can also be extremely useful. You can use remoteshellopt to specify an alternate port number if your machines do not run SSH on port 22.

You’re now ready to use dsh. To get the output of the w command from all of the machines listed in machines.list, run:

$ dsh –a w

If you’d like the name of the machine prepended to the output, add the –M option, as in dsh –M –a w.

While it should immediately be clear how useful dsh can be in a distributed environment, the machine group feature really increases the utility’s flexibility. You can create a distinct group for your Web cluster, another for your database cluster, and yet another for your compute servers. Machines can be grouped arbitrarily to let you execute commands on a subset of your infrastructure.

For example, if you create a Web group, you can restart Apache on all machines with:

$ sudo dsh –g web ’/usr/local/apache/bin/apachectl restart’

You can execute commands in a more ad-hoc fashion with –m (lowercase). For instance, the next command runs last on the machines test1 and production1:

$ dsh –m test1 –m production1 last

You can even point dsh to an arbitrary file with a list of machines names with the –f flag. As you can see, while dsh is very simplistic, it was built with flexibility in mind.

Finally, if you’re concerned about overwhelming your machinery with commands or want to progress more slowly, try –F to limit the number of concurrent commands. In most cases, you can ignore such a governor, but if you use dsh on a huge number of machines, it’s a good idea to set the limit somewhere between 100 and 200.

dsh is a simple mechanism to execute the same command on any number of remote machines. Its group feature makes it flexible enough for almost any environment.

Comments on "Remote Administration with DSH"

Check beneath, are some completely unrelated web sites to ours, having said that, they may be most trustworthy sources that we use.

Here is a great Blog You might Come across Exciting that we encourage you to visit.

Every when in a even though we pick out blogs that we study. Listed beneath are the most recent sites that we decide on.

Although sites we backlink to below are considerably not related to ours, we really feel they are really worth a go as a result of, so have a look.

Here are some links to web pages that we link to because we believe they’re really worth visiting.

That will be the end of this write-up. Right here you will obtain some web pages that we assume you will value, just click the hyperlinks.

Although web-sites we backlink to below are considerably not associated to ours, we really feel they are really worth a go by means of, so possess a look.

That is the end of this article. Here you?ll discover some internet sites that we believe you will enjoy, just click the links.

whoah this blog is magnificent i love reading your posts. Keep up the good work! You know, many people are looking around for this information, you could help them greatly.

Usually posts some incredibly exciting stuff like this. If you?re new to this site.

Check beneath, are some entirely unrelated internet websites to ours, nevertheless, they are most trustworthy sources that we use.

We came across a cool website which you could possibly love. Take a look in case you want.

Here are some links to internet sites that we link to simply because we believe they may be really worth visiting.

We like to honor numerous other internet sites on the net, even when they aren?t linked to us, by linking to them. Underneath are some webpages really worth checking out.

Please check out the web sites we stick to, such as this a single, as it represents our picks in the web.

Usually posts some quite fascinating stuff like this. If you are new to this site.

Wonderful story, reckoned we could combine a number of unrelated information, nonetheless definitely really worth taking a search, whoa did one particular master about Mid East has got far more problerms also.

This article will help the world wide web visitors for
developing new weblog or perhaps a blog from start to end.

my site :: ConradXWhy

That would be the end of this article. Right here you will uncover some internet sites that we think you will value, just click the links.

Always a massive fan of linking to bloggers that I adore but do not get a lot of link appreciate from.

Wonderful story, reckoned we could combine several unrelated data, nonetheless definitely worth taking a appear, whoa did one master about Mid East has got extra problerms also.

Sites of interest we have a link to.

The information and facts talked about within the article are a number of the most beneficial out there.

Below you?ll obtain the link to some web-sites that we think you should visit.

One of our guests not too long ago recommended the following website.

Here is a good Weblog You might Obtain Interesting that we encourage you to visit.

Here are several of the internet sites we advocate for our visitors.

Usually posts some really fascinating stuff like this. If you?re new to this site.

We prefer to honor lots of other online web pages on the net, even if they aren?t linked to us, by linking to them. Underneath are some webpages worth checking out.

Here is a great Weblog You may Discover Intriguing that we encourage you to visit.

Here is a good Blog You might Discover Intriguing that we encourage you to visit.

Usually posts some incredibly exciting stuff like this. If you?re new to this site.

The time to study or check out the content or websites we’ve linked to below.

We came across a cool web-site that you could possibly love. Take a search if you want.

Just beneath, are several completely not related web sites to ours, nonetheless, they may be surely worth going over.

Here is a superb Blog You might Find Interesting that we encourage you to visit.

We came across a cool internet site which you could possibly appreciate. Take a appear if you want.

Please go to the web sites we adhere to, which includes this a single, as it represents our picks from the web.

The time to read or go to the subject material or web sites we have linked to below.

Every after inside a whilst we decide on blogs that we study. Listed below would be the most current websites that we choose.

The details talked about within the post are some of the most effective offered.

We came across a cool web site that you might love. Take a search if you want.

Leave a Reply