I have a laptop that uses a VPN, and my hostname often changes. I get a different Erlang node name every time this happens. The docs for node ( http://erlang.org/doc/reference_manual/distributed.html ) do not seem to specify a way to set this statically.
How can I permanently configure my machine's nodename to be persistent across network changes?
If you are using Rebar, you should have a vm.args
somewhere and you can set the -sname my_permanent_node_name
flag in here.
Note that no communication can exist between nodes running with flag -sname and those running with flag -name.
Will still accept Asier's answer as it solved it for running normally.
Adding this because when running rebar3 ct
, I hit this issue: http://erlang.org/pipermail/erlang-questions/2016-March/088414.html . That is, rebar3 ct
does not respect the rebar.config
node name. I was able to solve this problem using an answer in that mailing thread:
set -x REBAR3_ERL_ARGS "-sname myapp@localhost"; rebar3 local install; env DEBUG=1 ~/.cache/rebar3/bin/rebar3 ct
So combined with these two answers I solved the problem.
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.