Setting up node clustering on Google Cloud Platform

I am trying to connect two nodes(instances) on GCP without much luck.
Both instances are running fine but they couldn’t connect to each other.
Running Node.list returned an empty []

I have setup vm.args and .hosts.erlang(this is saved under /home/user/)

vm.args

-name myapp@localhost
-setcookie justcookies
-smp auto
-kernel inet_dist_listen_min 9100 inet_dist_listen_max 9155

I have tried different .hosts.erlang but none of them works.

version 1 .hosts.erlang

10.152.0.2
10.152.0.3

version 2 .hosts.erlang

instance1.zone-b.c.project.internal
instance2.zone-b.c.project.internal

and port 4369 is opened as well

netstat -an | grep 4369
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:49871         127.0.0.1:4369          TIME_WAIT  
tcp6       0      0 :::4369                 :::*                    LISTEN  

Am I missing some files or got the wrong concept on how node discovery works?

If you use localhost as the domain, both applications need to run on the same server. A node will not accept incomming connections that call him by the wrong canonical name.

Is your application run as user?

Yeah, something is listening. But is it opened in the firewall as well?

According to Erlang -- net_adm your syntax here is wrong.

You need to specify one hostname per line as quoted atoms (erlang syntax, so enclosing them in single quote). Each line has to be end by a dot. And the last line needs a trailing newline as well.


I am missing the part of the code where you actually try to connect to your nodes.

3 Likes

Thank you very much.

.hosts.erlang(mistake only in this question) and port are working fine.

The problem was actually caused by -name myapp@localhost in vm.args.
Once I changed it ot myapp@#{actual_ip/dns} and they are now connected.

The only thing I have work work out now is how to generate -name in build time.:thinking:

1 Like