I want to change the node name of a beam instance dynamically.
The usecase is in a cluster of VM's I would like the startup process to lookup the ip information and then pick a name from that.
node()
# => :nonode@nohost
# Lookup ip and change name
node()
# => :[email protected]
Yes, you can use net_kernel:start/1
in Erlang or Node.start/{1,2,3}
in Elixir:
1> node().
nonode@nohost
2> net_kernel:start(['[email protected]']).
{ok,<0.60.0>}
([email protected])3> node().
'[email protected]'
iex(1)> Node.self
:nonode@nohost
iex(2)> Node.start :"[email protected]"
{:ok, #PID<0.83.0>}
iex([email protected])3> Node.self
:"[email protected]"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With