Reputation: 24558
I am trying to build a cluster using amazon EC2 instances.
Do I have to set the hostname of each node to what is listed in the .hosts.erlang
file?
Currently, .hosts.erlang
for each node has:
'ip-10-0-23-186.eu-central-1.compute.internal'.
'ip-10-0-5-10.eu-central-1.compute.internal'.
which are the private DNS of nodes.
and in the vm.args
of nodes, I have something like this:
-name [email protected]
I tried to change the hostname to the full private dns, but it only changed to:
ip-10-0-5-10
I checked the cluster, got empty:
$ erl
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Eshell V8.0 (abort with ^G)
1> nodes().
[]
I deploy my app using edliver, how can I debug why erlang does not create the expected cluster?
I tried in iex:
iex(3)> hosts_path = Path.expand("/home/admin/.hosts.erlang")
"/home/admin/.hosts.erlang"
iex(4)> :net_adm.world(:verbose)
[]
edit
I can confirm that the .hosts.erlang
can be read:
iex(2)> File.read("/home/admin/.hosts.erlang")
{:ok,
"'ip-10-0-23-186.eu-central-1.compute.internal'.\n'ip-10-0-5-10.eu-central-1.compute.internal'.\n\n"}
is there a specific folder that I have to run erl from?
In the browser, I can see the app working normally, but I am not sure about the cluster.. please help!
As I am using AWS, here is the security group I am on currently:
Upvotes: 4
Views: 557
Reputation: 24558
Ok, I found the solution, I had to define the ip address of nodes in the hosts file at /etc/hosts
of each node
10.0.23.186 ip-10-0-23-186.eu-central-1.compute.internal
10.0.5.10 ip-10-0-5-10.eu-central-1.compute.internal
Upvotes: 1