When using Elixir's interactive shell IEx, I can create a node by command:
iex --sname node_name
But how can I create a node by code, then run the code by:
elixir code.exs
There are some function like node(), but it seems that those function just return a node existed.
Use
elixir --sname node_name
Generally, you pass the node name so that everything starts up knowing its own name. However, it is apparently also possible to set the name while running with the Erlang net_kernel module, as described in the answer to How set Erlang node name...
If you are doing an Erlang release you can use the vm.args
file. This is how you do it if using exrm
to build a release.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.