liveBook · Manning

Remote shell

As explained in Elixir in Action, Third Edition

A remote shell is an interactive shell session that executes expressions in the context of another running runtime node.

A remote shell is an interactive IEx session whose expressions execute on another running BEAM node. It turns a live system into an operational workspace without requiring the production process to run in the foreground. section 13.1.1 section 13.4

Use a remote shell to:

  • Inspect runtime and process state with functions such as :erlang.system_info/1, :erlang.memory/0, Process.list/0, and Process.info/1. section 13.3.3
  • Send messages, stop or restart processes and supervisors, stop OTP applications, or reload module code. section 13.3.3
  • Connect to a detached node with iex --remsh, or attach to a release through its remote command. section 13.1.1 section 13.2.2
  • Keep the production node running when the remote shell exits; stopping the node itself terminates its applications and BEAM instance. section 13.1.1 section 13.2.2

Attach to a running node

Start a hidden debugger node and use it as a shell for todo_system: `iex --sname debugger@localhost --remsh todo_system@localhost --hidden`. The prompt identifies the target node, and calls run there rather than on the debugger node. section 13.1.1

$ RELEASE_NODE="todo@localhost" _build/prod/rel/todo/bin/todo remote

iex(todo@localhost)1>

A release exposes a direct remote-shell command, separating shell access from starting, stopping, and daemonizing the production system. section 13.2.2

How Elixir in Action, Third Edition covers it

How deep it goes
Explains attachment, lifecycle, inspection, and control workflows, but defers detailed distributed-node configuration.
Examples
Demonstrates --remsh attachment, release remote commands, runtime inspection, process control, and remote Observer access.
What it assumes
Assumes compiled Elixir systems, BEAM nodes, OTP applications, and releases; teaches remote interaction through runnable commands.
What you can do after
Operate/configure a running BEAM node, inspect its processes, control applications, and connect diagnostic tools remotely.
How it connects
Connects BEAM nodes with IEx, OTP applications, processes, distributed systems, releases, and Observer.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.