I’m experimenting with libcluster
and starting by setting up a simple “first node” for said cluster.
Before I even get into libcluster, though, I’m having trouble starting distributed Erlang. This is the entirety of my so-far-very-simple application:
defmodule MyApp do
@moduledoc false
use Application
def start(_type, _args) do
IO.inspect(:erlang.node(), label: "node")
IO.puts "starting self"
IO.inspect(:net_kernel.start([:"my_hub@localhost"]), label: "nk start")
topologies = [
my_swarm: [
strategy: Cluster.Strategy.Epmd,
config: [hosts: [:"my_hub@localhost"]]
]
]
children = [
{Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]}
]
Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
end
end
And it fails in the following way:
$ mix run
Compiling 1 file (.ex)
node: :nonode@nohost
starting self
11:19:33.205 [info] Protocol 'inet_tcp': register/listen error: econnrefused
nk start: {:error,
{{:shutdown, {:failed_to_start_child, :net_kernel, {:EXIT, :nodistribution}}},
{:child, :undefined, :net_sup_dynamic,
{:erl_distribution, :start_link, [[:my_hub@localhost], false]}, :permanent,
1000, :supervisor, [:erl_distribution]}}}
My Googling thus far has not yielded any results. What should I be looking for?