KB37199 - [Contrail] How to start a tmux session in Contrail [juniper.net] covered how to start a tmux session in the RHOST13 Contrail environment and log in to a Contrail node inside of it. This article covers some tmux commands that are frequently used in day-to-day operations:
Split a window into multiple panes.
Jump between panes.
Create new windows.
Jump between windows.
In KB37199 - [Contrail] How to start a tmux session in Contrail [juniper.net] , you logged in to one Contrail node "cc0." You also listed all Contrail nodes with the openstack server list command, and the output showed five nodes:
openstack server list
Contrail Controller0 (cc0)
Contrail Controller1 (cc1)
Contrail Controller2 (cc2)
Contrail Compute0 (cp0)
OpenStack Controller (oc0)
In this article, you will learn how to log in to multiple Contrail nodes within the same tmux session.
To log in to multiple Contrail nodes and to split a pane, perform the following steps:
Log in to the first node "cc0":
(undercloud) [stack@queensa ~]$ ssh [email protected] Last login: Sun Jun 13 02:09:31 2021 from 192.168.24.1 [heat-admin@overcloud-contrailcontroller-0 ~]$ sudo -i [root@overcloud-contrailcontroller-0 ~]# docker ps | head | less -XES CONTAINER ID IMAGE 7f388cdaf74f 192.168.24.1:8787/contrail/contrail-provisioner:2011.138 ffd83cf89aba 192.168.24.1:8787/contrail/contrail-provisioner:2011.138 1c5a6803d3c0 192.168.24.1:8787/contrail/contrail-provisioner:2011.138 b498e91f9708 192.168.24.1:8787/contrail/contrail-provisioner:2011.138 1732472343c8 192.168.24.1:8787/contrail/contrail-provisioner:2011.138 2358bc22c88e 192.168.24.1:8787/contrail/contrail-nodemgr:2011.138 879e0119e6a1 192.168.24.1:8787/contrail/contrail-nodemgr:2011.138 1dd204307ea6 192.168.24.1:8787/contrail/contrail-controller-control-named:2011.138 f9304d8c1fc1 192.168.24.1:8787/contrail/contrail-controller-control-dns:2011.138
Log in to the second Contrail node "cc1." With tmux, the idea is to "split" the current SSH "window" into two "panes". The first pane will hold the existing SSH session toward "cc0," and the second (new) pane will have a new SSH session into the other node "cc1."
There are basically two methods to split the current window, and you type different commands to implement each splitting method:
To split the window horizontally, press " ctrl-b + " ". This means that you need to press and hold " ctrl-b ," and then press the " " " key.
ctrl-b + "
ctrl-b
"
To split the window vertically, press " ctrl-b + % ". This means that you need to press and hold " ctrl-b ," and then press the "%" key.
ctrl-b + %
Note: In this article, you use "A + B." This means that you press and hold key "A" first, and then press key "B" at the same time.
For "cc1," you want to place the session on the right part of the screen. So you will split the screen vertically by pressing and holding " ctrl-b ," and then pressing " % ". A new shell terminal will appear on the right.
%
From the new pane, you can log in to the second node:
Now you will have two terminal panes side by side, with each one containing an SSH session that is logged in to a different node. To switch cursors between the two panes, use " ctrl-b + LEFT ", " ctrl-b + RIGHT ", " ctrl-b + UP " and " ctrl-b + DOWN " to go left, right, up, and down the panes, respectively.
Now you will have two terminal panes side by side, with each one containing an SSH session that is logged in to a different node.
To switch cursors between the two panes, use " ctrl-b + LEFT ", " ctrl-b + RIGHT ", " ctrl-b + UP " and " ctrl-b + DOWN " to go left, right, up, and down the panes, respectively.
ctrl-b + LEFT
ctrl-b + RIGHT
ctrl-b + UP
ctrl-b + DOWN
To log in to the third and fourth nodes, split both panes horizontally by pressing " ctrl-b + " ":
Now we end up with four panes in one window, each session logged in to four nodes in all. Whenever you need to log in to more nodes, repeat the same process to split the current window even further. Sometimes, you may have more than four nodes to log in to, but you do not want to see too many panes in one window. In this case, you can start new tmux windows to log in to new nodes. To create a new tmux window, press " ctrl-b + c" :
Now we end up with four panes in one window, each session logged in to four nodes in all. Whenever you need to log in to more nodes, repeat the same process to split the current window even further.
Sometimes, you may have more than four nodes to log in to, but you do not want to see too many panes in one window. In this case, you can start new tmux windows to log in to new nodes. To create a new tmux window, press " ctrl-b + c" :
ctrl-b + c"
At the bottom, there is a tmux status line with the number of all windows. The " *" sign indicates that you are now in the second window. From here, you can repeat the splitting process to create more panes to log in to new nodes. To select another window, press " ctrl-b + WINDOWS-NUMBER ."
*"
ctrl-b + WINDOWS-NUMBER