Rocu.de

Love, caffeine and omlette

Command line tapas: Feel like a hacker with cluster ssh

A few months ago I paired on a chef recipe with a colleague. After we
uploaded the cookbook we wanted to try this stuff out on a few nodes.

Until then I would have kind of done it completely manually. But he
entered a command and the following happend:

ClusterSSH in action

Wow. He just ssh'ed into all of these servers. The next part looked even
cooler. He started typing and magically the text appeared in all the
terminals. He pressed enter and the chef run started. It looked awesome. Chef runs produce quite a lot of text 😉

I was hooked and asked him what he just did. "That's just ClusterSSH", he
replied, "I use it all the time".

ClusterSSH is a tool for making the same change on multiple servers at
the same time. The 'cssh' command opens an administration console and
an xterm to all specified hosts. Any text typed into the
administration console is replicated to all windows. All windows may
also be typed into directly.

For the Mac there is a similar tool called csshx thats what I ended
up using.

It works like a charm. You just specify your clusters in a clusterfile.

cluster1 host1 host2
cluster2 host3 host4

Now you just enter:

csshx cluster1

That's it.

I use csshx during every maintainance window. I love
pair programming. Makes you realize that things that are obvious to
yourself are not obvious to your colleagues.

1 Comment

  1. as an update to anyone reading this, there are two other alternatives:

    1) iTerm2 native support for terminal multiplexing (only works locally)
    2) tmuxinator for tmux

    While you shouldn't be logging into servers on a regular basis, tmuxinator works also works really well on a gateway server, allowing you to set up aliases for devs to get access to all servers in an environment. It also supports grouping into tmux windows (one window = background job servers, another window = web/app servers, etc.).

    This can also work really well if you are bundling a cluster in vagrant, where someone checking out a configuration can just run "mux ".

    https://github.com/tmuxinator/tmuxinator
    http://nils-blum-oeste.net/getting-started-with-tmux/

    It also supports send-keys, so you can set up dev projects and automatically create 3 panes, loading vi into one and launching services in another others (guard for rails dev, npm, mysql, docker containers, docker-compose, whatever).

    http://zdk.github.io/manage-different-tmux-configurations-with-tmuxinator

Leave a Reply

Your email address will not be published.

*

© 2017 Rocu.de

Theme by Anders NorenUp ↑