Mix release cannot auto discover new node

After upgrading from elixir 1.6 and distillery to elixir 1.11 and mix release, nodes in cluster are no longer auto joining each other.

  1. def start(_, _), do: :net_adm.world() is in defmoudle MyApp.application
  2. .hosts.erlang is loaded properly and contains all IPs
iex(prod@myapp-upgrade-group-wfs3)2> :net_adm.host_file
[:"10.152.0.56", :"10.152.15.238", :"10.152.0.20", :"10.152.0.17"]
  1. Node.list returns [] but doing a Node.ping(:"prod@myapp-upgrade-group-another_node") and they will join each other and Node.list would returns properly.

  2. There is no rel directory in my project now but I did have one for distillery. This is the biggest difference I can think of.

The problem is indeed due to the missing of rel/env.sh.eex. More specifically, the missing of these two lines

+export RELEASE_DISTRIBUTION=name
+export RELEASE_NODE=<%= @release.name %>@${HOSTNAME}
1 Like