clusterssh to tmux cluster
Tue, Nov 24, 2020
I’ve been looking for a clusterssh replacement. Clusterssh is great for quickly getting interactive shells on every node in a small cluster. This is particularly useful to tail logs on certain types of system, like a cluster of mail servers. The only problem is that it’s linux specific. I was hoping for something a little more portable, and I found this: tmux cluster
It reads the same config files as clusterssh, and makes opening synchronized tmux panes to each node in a cluster super easy.tmux cluster, tmc, mostly just works, so now instead of
cssh cluster I can
tmc cluster to open ssh connections to the same clusters I already have defined.
The couple of annoying behaviors I found were easily worked around with simple tmux commands. The relevant “workarounds” I found are:
tmc always opens tmux in tile layout, which is less than stellar for an odd number of hosts. No worries, it’s easy to switch to another layout with the
^b-M[1-5]layout switching keybindings.
tmc opens all panes in synchronize mode (which is kind of why we want it), but sometimes It’s nice to select only one node in the cluster to work with. Switching to working on a specific pane you first need to disable synchronzie-panes with:
^b :setw synchronize-panes. Then switch between panes with
I’m a tmux ingenue, so if my phrasing above is clumsy, well, you probably didn’t need this advice anyway ;) I find the tmx cheatsheet site to be pretty helpful.