tags:

views:

65

answers:

1
+1  Q: 

Nodes not talking

I am using Ubuntu 9 and I start two nodes with:

erl -name node1 -setcookie demo

and

erl -name node2 -setcookie demo

yet when I run "nodes()" the nodes do not see each other and it returns an empty list. Anyone know why?

+4  A: 

Because they are not connected unless they communicate with each other, e.g. by one pinging the other:

(node1@<host>)> net_adm:ping(node2@<host>).

Note that if you checked the nodes with net_adm:names(), they would have been visible via epmd.

Zed
I did that but it returns "pang". Each node if pinging itself gets a "Pong" though
Zubair
and net_adm:names() returns:{error,nxdomain}
Zubair
Is your hostname included in the hosts file?
Zed
Also, try using -sname <name> instead. This will create local nodes which are easier to connect. (-sname creates short host names and -name creates long ones).
Adam Lindberg
How do I add my hostname to the hosts file?
Zubair
I tried with -sname instead of -name when running erl, but still the nodes do not see each other
Zubair
There should be a hosts file at /etc/hosts, or \Windows\system32\drivers\etc\hosts. You must add host to be translated into 127.0.0.1, e.g. `127.0.0.1 localhost myhost`. Alternatively you could use localhost, or 127.0.0.1 as your hostname to check if things are working...
Zed