Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

net_kernel:start fails with `{'EXIT',nodistribution}`

Tags:

erlang

I faced with a problem and hope that someone can help me.

I try to start net_kernel by :

net_kernel:start([test,shortnames]).

But I faced with this error :

{error,
    {{shutdown,
         {failed_to_start_child,net_kernel,{'EXIT',nodistribution}}},
     {child,undefined,net_sup_dynamic,
         {erl_distribution,start_link,[[test,shortnames]]},
         permanent,1000,supervisor,
         [erl_distribution]}}}

=INFO REPORT==== 23-Apr-2017::21:07:43 ===
Protocol: "inet_tcp": register/listen error: econnrefused

Amazing tip is that when trying to start net_kernel by:

erl -sname test

net_kernel will start successfully

and another amazing tip is that after start net_kernel at least one time after OS boot and exit erl shell , the first way to start net_kernel will work successfully :|

( net_kernel:start([...]) )

after some search I found that CouchBase and RabbitMQ-Server and Ejabberd and some other apps that uses erlang , reported this error ( nodistribution error )

like image 986
KoLiBer Avatar asked Apr 23 '17 17:04

KoLiBer


1 Answers

You have no epmd running, that'll be what the econnrefused is about. When you start net_kernel it wants to register a name with epmd so the node is findable.

Make sure there is an epmd process running at the time you start net_kernel and I bet the problem goes away.

Regarding erl -sname test working, I expect that starts epmd for you?

like image 160
Michael Avatar answered Sep 21 '22 13:09

Michael