<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Yes both nodes have the same cookie.<br>
<br>
Thanks<br>
Khitai<br>
<br>
<div class="moz-cite-prefix">On 2016/3/6 19:23, Éric Pailleau wrote:<br>
</div>
<blockquote
cite="mid:9108a3loth14a5gq45avu38f.1457263413758@email.android.com"
type="cite">
<p dir="ltr">Hi, </p>
<p dir="ltr">Did you check that both have same cookie ?</p>
<p dir="ltr">"Envoyé depuis mon mobile " Eric</p>
<br>
<br>
---- Khitai Pang a écrit ----<br>
<br>
Hi,<br>
<br>
I'm having some problems with distributed erlang on Linux.<br>
<br>
I have two ubuntu hosts, and on each node the ERL_EPMD_PORT
environment <br>
variable is set to 5779.<br>
<br>
Hostnames are properly set in /etc/hosts on both hosts. Erlang is
<br>
started on the two hosts by<br>
<br>
$ erl -sname er1@host1<br>
<br>
(er1@host1)1> node().<br>
er1@host1<br>
<br>
$ erl -sname er2@host2<br>
<br>
(er2@host2)1> node().<br>
er2@host2<br>
<br>
and epmd is running on both hosts listening on 5779.<br>
<br>
<br>
Question 1: Why does connecting to er2@host2 using <br>
net_kernel:connect_node/1 fail?<br>
<br>
(er1@host1)4> net_kernel:connect_node(er2@host2).<br>
false<br>
<br>
It runs for a couple seconds and returns false.<br>
<br>
Is it because epmd is not listening on the default port?<br>
<br>
<br>
Question 2: If epmd is not running, when I run <br>
net_kernel:start([er1@host1, shortnames]), it returns error. Why?
If <br>
it's caused by epmd not running, how to make sure that epmd is
started <br>
when you start an OTP release?<br>
<br>
1> net_kernel:start([er1@host1, shortnames]).<br>
{error,<br>
{{shutdown,<br>
{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}},<br>
{child,undefined,net_sup_dynamic,<br>
{erl_distribution,start_link,[[er1@host1,shortnames]]},<br>
permanent,1000,supervisor,<br>
[erl_distribution]}}}<br>
<br>
<br>
Question 3: After starting erl with -sname, if you run netstat,
you'll <br>
see a process listening on a random port, what is it?<br>
<br>
tcp 0 0 0.0.0.0:<a moz-do-not-send="true"
href="tel:23333">23333</a> 0.0.0.0:* LISTEN <br>
12650/<a moz-do-not-send="true" href="http://beam.smp">beam.smp</a><br>
<br>
<br>
Question 4: If an OTP release is meant to run on multiple nodes,
how to <br>
properly set node name and start distribution on each node <br>
automatically? I want to start running the release on all nodes
by <br>
running one command on one of the nodes.<br>
<br>
Currently I'm planning to do it this way:<br>
<br>
1) hardcode all participating hostnames in <a
moz-do-not-send="true" href="http://sys.conf">sys.conf</a>,
something like <br>
[{"er1", "host1"}, {"er2", "host2"}]<br>
2) on each host, when the erlang application starts, it reads the
config <br>
from <a moz-do-not-send="true" href="http://sys.conf">sys.conf</a>,
finds its own name and use net_kernel:start/1 to set the <br>
node name and start distribution<br>
<br>
What is the best practice to do it?<br>
<br>
<br>
Thanks<br>
Khitai<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a moz-do-not-send="true"
href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote>
<br>
</body>
</html>