How to work on multiple servers together in a single time ?

Today we will introduce you to a very useful tip to perform server operations on multiple servers together.

For this we will use a a application called csshx shared by Gavin Brock.

You can visit on below URL to download this master piece of code or google csshx i.e. Cluster SSH:
https://github.com/brockgr/csshx

 

Using Cluster SSH

To use cluster ssh to execute a command on multiple servers together, we need to create a hostfile which contains the list of all hosts on which we want to execute the commands together.

The beauty of cluster SSH is that we can also execute the command individually when we want and can also execute a command on all hosts together.

To use this, run csshX script with list of hosts’ file.

user@ngelinux$  cat hostfile
R161-example.com
R186-example.com
R189-example.com
R199-example.com
R213-example.com
R217-example.com
R219-example.com
R236-example.com
R285-example.com
R294-example.com
R297-example.com
R298-example.com
R300-example.com
R305-example.com
R317-example.com
R322-example.com

#### Now lets open a master window to execute our command on all above servers.
#### Ctrl + W —> Shortkey to close the windows

user@ngelinux$ ./csshX -l saket --hosts hostfile

After running above csshx script, it will open multiple windows and arrange it according to screen ratio.

And also open a master terminal in screen bottom where we can type and run commands on all servers in one go.

Ngelinux.com csshx example

Leave a Reply

Your email address will not be published.