无法通过erl_boot_server加载Erlang远程代码

axzmvihb  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(164)

I'm testing erlang remote code loading via -loader inet option without the slave option.
Two elixir emulators (consoles) on the same box for now. The master running a custom project:

Master

shell> iex --sname master --cookie abc123 -S mix

master iex> :erl_boot_server.start([{127,0,0,1}])
{:ok, #PID<0.134.0>}

The other running bare:

Worker

shell> iex --sname worker --cookie abc123 --erl "-hosts 127.0.0.1 -id worker -loader inet"

worker iex>

How does exacly the automatic remote code loading suppose to work? When I try to load module on the worker I get:

worker iex> Code.ensure_loaded(MyModule)
{:error, :nofile}

On the master this does work:

master iex> Code.ensure_loaded(MyModule)
{:module, MyModule}

I know the worker node does find the master and connect to it's boot server because when the master is not present, I get the message:

{erl_prim_loader,'no server found'}

I have tried also to add all the code paths to the worker via Code.append_path but still when I try to load the module it does not find it.

q9yhzks0

q9yhzks01#

尝试在您的主服务器上运行此命令:

:rpc.call(:'worker', :code, :add_paths, [:code.get_path])

完成后,您应该能够在worker节点上自动加载代码。

相关问题