Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Cluster ssh

News Enterprise Unix System Administration Recommended Links Unix Configuration Management Tools pssh Slurping C3 Tools parallel
rsync rdist Cluster SSH Mussh Pdsh a multithreaded remote shel pdcp    
SSH Power Tool Tentakel Multi Remote Tools     Perl Admin Tools and Scripts Grid Engine Unix System Monitoring
SSH Usage in Pipes Password-less SSH login scp sftp Tips History Humor Etc

Cluster ssh is a Perl program written in  Perl in 1999-2010 by Duncan Ferguson. It is still actively maintained on Sorceforge ( Cluster SSH - Cluster Admin Via SSH ).

It is now included in Ubuntu and Debian.  Licensed like most Perl packages under GNU General Public License as published by the Free Software Foundation or the Artistic License.

Cluster ssh can help to administer multiple ssh or rsh shells simultaneously. ClusterSSH allows you to control multiple ssh or rsh sessions from a single input window. You can also configure clusters of machines for easy invocation and interact with individual terminal windows during a session.

Configuration Files

This /etc/clusters file is cluster tag database. Contains a list of tags and hostnames, in the form

<tag> [<username>@]hostname [...]

Newlines and comments (delimited with a #) are ignored.

Cluster definitions can also be added to the $HOME/.csshrc file

This /etc/csshrc file is Global configuration file, sourced by all users. Can be generated by:

sudo cssh -u > /etc/csshrc

$HOME/.csshrc

Per user configuration file. Can be generated by:

cssh -u > /etc/csshrc </tt>

To add a cluster definition to this file, use the following format

cluster_tag1 = server1 server2 user@server3
cluster_tag2 = server4 server5
clusters = cluster_tag1 cluster_tag2

Be aware of using �reserved names� and no check is currently performed for them.

Using Cluster SSH

If you want to perform the same command on the three servers one, two, & three use the following command

sudo cssh one two three

This will open three consoles, one for each server, over an ssh connection, and one little console to type your command.

NEWS CONTENTS

Old News ;-)

ssh on multiple servers Using cluster ssh

Cluster SSH opens terminal windows with connections to specified hosts and an administration console. Any text typed into the administration console is replicated to all other connected and active windows. This tool is intended for, but not limited to, cluster administration where the same configuration or commands must be run on each node within the cluster. Performing these commands all at once via this tool ensures all nodes are kept in sync.

Introduction

What is ClusterSSH and what is it used for?

Ever had to make the same change on more than one Linux/unix server? Find it annoyingly painful to keep repeating the exact same commands again and again and again?

This tool addresses exactly this problem. You run a utility (cssh) providing a number of server names as parameters, and then xterms opens up to each server with an extra "console" window. Anything typed into the console is replicated into each server window (so, for examples, you can edit the same file on N machines at the same time, or run the same commands with the same parameters across those servers).

It is also possible to type into the server windows directly, or temporarily disable replication to one or more of the servers through the "Hosts" menu.

Difference between ClusterSSH and "cssh"

The utility itself is called "cssh". The project name is ClusterSSH. The project is not called "cssh" because when the project was first registered on SourceForge a project already existed using that name ("C sharp" unix shell).

Install cluster ssh on debian

#apt-get install clusterssh

Configuration Files

This /etc/clusters file is cluster tag database. Contains a list of tags and hostnames, in the form

<tag> [<username>@]hostname [...]

Newlines and comments (delimited with a #) are ignored.

Cluster definitions can also be added to the $HOME/.csshrc file

This /etc/csshrc file is Global configuration file, sourced by all users. Can be generated by:

cssh -u > /etc/csshrc

$HOME/.csshrc

Per user configuration file. Can be generated by:

cssh -u > /etc/csshrc</tt>

To add a cluster definition to this file, use the following format

cluster_tag1 = server1 server2 user@server3
cluster_tag2 = server4 server5
clusters = cluster_tag1 cluster_tag2

Be aware of using "reserved names" and no check is currently performed for them.

Using Cluster SSH

If you want to perform the same command on the three servers one, two, & three use the following command

# cssh one two three

This will open three consoles, one for each server, over an ssh connection, and one little console to type your command.

Related content:
  1. Howto perform UDP tunneling through SSH connection
  2. SSH your Debian servers without password
  3. sshpass -- Non-interactive ssh password authentication
  4. Update passwords in batch mode Using chpasswd
  5. How to add a Disclaimer To Outgoing Emails in Postfix

Cluster SSH by Dan Stoner

January 24 2012 | thatlinuxbox.com
01

ClusterSSH is a nice tool for manipulating multiple *nix machines simultaneously. For example, if I want to run some commands on two Linux machines named server1 and server2, I could:

# cssh server1 server2

And I will get two xterm windows that I can control simultaneously by typing into the cssh command window. Since cssh will send keystrokes to both servers, any series of commands can be run, including editing files, etc. I have found that my daily patterns of behavior make cssh preferable to similar tools such as pdsh. Also, cssh uses very similar options syntax to the ssh command, so I don't have to remember different options (I frequently use -l and -p).

I might want to tail the logs on all of the machines in the cluster, but then focus in on one particular machine after I have identified a particular cluster node of interest. Similarly, I might work out a long command line on a single node before running it on the rest of the machines via the cssh command window.

In Debian and Ubuntu, cssh can be installed with:

# sudo apt-get install clusterssh

Cluster SSH is also available for Mac OS X (http://code.google.com/p/csshx/).

A clusterssh package seems to be working its way into Red Hat flavors via Extras or 3rd party repos such as rpmforge.

After running cssh for the first time, you will have a .csshrc file in your home directory. This file can be tweaked in various ways to make connecting to groups of machines easier. To save a group of machines into a list that you can re-use, cssh can use a plain text cluster file.

To use a cluster file:

Step 1: Create a file named .clusters that contains your list of server groups. The format of the file is just a friendly name for a cluster followed by all of the machines that you want to connect as part of that cluster, with white space in between.

For example, my .clusters file looks something like:

prod_servers server1 server2 server3 server4

test_servers testserver1 testserver2

Step 2: Modify .csshrc to tell cssh to use the clusters file.

extra_cluster_file=~/.clusters

Now that I have a cluster defined, I can connect to my prod servers all at once by running:

# cssh prod_servers

In my example case, this would open four xterms to the four servers. If I type into the cssh command window the text will go to all four xterms. If I only want to run a command on one of them, I just click on the particular xterm to give it focus and it behaves like a normal individual xterm.

I have found cssh to be a valuable utility in my sysadmin toolbox.

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

Top articles

Sites

Cluster SSH - Cluster Admin Via SSH SourceForge.net

ssh on multiple servers Using cluster ssh

cssh(1) Cluster administration tool - Linux man page

Ubuntu Manpage cssh (crsh, ctel) - Cluster administration tool




Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater�s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright � 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 29, 2020