It depends on how you started the OTP application. To connect to a node, it must be started using the --name or --sname . You can check the name of the current session with node()
$ iex Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false] Interactive Elixir (1.3.0) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> node() : nonode@nohost
The name node is an atom, where the first part is the actual name of the node and the second is the host. The host is used for routing, so itβs hard to connect to a node that is deployed to nohost .
If you run iex with a short name ( --sname ), it will automatically determine your hostname.
$ iex --sname foo --cookie ciastko (...) iex( foo@MacBook-Pro-Tomasz )1> node :" foo@MacBook-Pro-Tomasz "
In another console, launch iex with a different name and the same cookie and try Node.connect(:" foo@MacBook-Pro-Tomasz ") . They must connect.
You probably haven't run the phoenix app with this, and now you cannot connect. To start Phoenix with this feature next time, you need to run:
elixir --sname some_name --cookie ciastko -S mix phoenix.server
source share