使用“eval”开始混合发布时无法连接到 libcluster

Can't connect to libcluster when starting mix release with `eval`

如果您在 eval 代码中调用 Application.ensure_all_started(:app),那么 starteval 是否有区别?出于某种原因,在使用 eval.

启动应用程序时,我在连接到 libcluster 节点时遇到问题

我收到这个错误 unable to connect to :\"app@10.32.0.60\": not part of network

使用start

时连接正常

来自 mix release

上的文档

The eval command starts its own instance of the VM but without starting any of the applications in the release and without starting distribution.

重点是我的。

:"app@10.32.0.60" 是需要启动分布式 erlang 的长名称。

花哨的描述性“不是网络的一部分”错误消息试图准确地告诉您这一点。通常,您可以使用 Node.start/3 在分布式模式下重新启动您的节点,然后重新启动您的应用程序,但我会避免这种情况并使用 start,在这种情况下,这似乎是您真正需要的。