Restoring a TTY Session
Restore a TTY-connected application instance on the command line, optionally using tmux to redirect the TTY session.
Before you begin
Capture a snapshot of an application with an active command-line session, for example a Redis client console. See Capturing a Snapshot with CLI.
About this task
If you restore a snapshot of a process with an attached TTY session, the session opens on your current command line and blocks further shell input. To restore the TTY session to a different output (and have the current shell return), use the --tmux-session option when restoring.
Procedure
-
Restore the session. Assign a tmux session name with the
--tmux-session option and, if you want, the
tmux socket with the --tmux-socket
option. For example:
$ mvmcli snapshot restore -l rediscli_511fc478 --tmux-session rc1 --tmux-socket /tmp/tmux-1022/my_tmux_socket
When using the --tmux-socket option, you must give the full pathname to the socket. For example: /tmp/tmux-1022/my_tmux_socket.
Each tmux socket is attached to a different tmux server. You can open additional tmux sessions and attach restored snapshots if, for example, you need different tmux options for different applications.
If you don't need different tmux configurations, you can ignore the --tmux-socket option and simply use the default in all instances.
- Optional:
List tmux sessions on the host with the tmux
list-sessions command. For example:
$ tmux list-sessions rc1: 1 windows (created Wed Sep 15 21:14:42 2021) [80x24]
-
Connect to the session using the tmux a command:
$ tmux attach -t session_name
where session_name is the name you supplied to the tmux-session option. For example:$ tmux attach -t rc1 [rc1] 0:mvsnap* "testdemo" 21:23 15-Sep-21
Important: You must have permission to access the tmux socket file path. We recommend that you log in as (or su to) the owner of the socket file path before connecting to the session.