Connection refused when trying to run Rabbitmq

1.3k Views Asked by At

Recently I have installed Rabbitmq 3.6.2 on Ubuntu 14, but whenever i run rabbitmq-server command it gives me error:

{error_logger,{{2016,7,5},{13,45,12}},"Protocol: ~tp: register/listen error: ~tp~n",["inet_tcp",econnrefused]}
{error_logger,{{2016,7,5},{13,45,12}},crash_report,[[{initial_call,{net_kernel,init,['Argument__1']}},{pid,<0.21.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,320}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[#Port<0.93>,<0.18.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,805}],[]]}
{error_logger,{{2016,7,5},{13,45,12}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[[rabbitmqprelaunch1853,shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2016,7,5},{13,45,12}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
{error_logger,{{2016,7,5},{13,45,12}},crash_report,[[{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.9.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,133}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}},{ancestors,[<0.8.0>]},{messages,[{'EXIT',<0.10.0>,normal}]},{links,[<0.8.0>,<0.7.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,117}],[]]}
{error_logger,{{2016,7,5},{13,45,12}},std_info,[{application,kernel},{exited,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}

I checked iptables there is no rules in there. I am sure that rabbitmq is not running and port is available. I am not a linux guru, so not sure where to search.

UPDATED:

/etc/rabbitmq folder is empty,maybe because it didn't finish the configuration with apt-get (and there is no rabbitmq-env.conf):

Setting up rabbitmq-server (3.6.2-1) ...
* Starting message broker rabbitmq-server
* FAILED - check /var/log/rabbitmq/startup_\{log, _err\} [fail]
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
dpkg: error processing package rabbitmq-server (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

My ifconfig looks like this (Added xx in the ip address for privacy reasons):

 lo Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:56 errors:0 dropped:0 overruns:0 frame:0
      TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:2800 (2.8 KB)  TX bytes:2800 (2.8 KB)

 venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
      inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255
      UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
      RX packets:7323 errors:0 dropped:0 overruns:0 frame:0
      TX packets:8256 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:919045 (919.0 KB)  TX bytes:1688814 (1.6 MB)

 venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
      inet addr:185.xx.xx.176  P-t-P:185.xx.xx.176  Bcast:185.xx.xx.176  Mask:255.255.255.255
      UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

Thanks!

2

There are 2 best solutions below

0
Tadas Stra On BEST ANSWER

Solution would be to download latest ErLang from official website:

https://www.erlang-solutions.com/resources/download.html

I have downloaded v19 for Ubuntu Precise and now it works well.

6
rpadovani On

Looking to your loopback interface it seems you disabled IPv6 on your machine (there is no inet6 entry).

Now, accordingly to this bug epmd didn't support IPv6, so they patched it, but now it requires IPv6 to be enabled to start (look comments #16 and #17).

Since there is no other activity on that bug, I suggest to try to enable IPv6 on your machine.

A possible workaround is using IPV4-mapped IPV6 address.

Add to your /etc/rabbitmq/rabbitmq-env.conf the following line:

ERL_EPMD_ADDRESS=::ffff:127.0.1.1

Old answer

There are a lot of different possible root causes to your error. I suppose you configured RabbitMq to use a IPv6 address, or you have some strange network configuration that doesn't have an IPv4.

I think it worth a shot to try to edit /etc/rabbitmq/rabbitmq-env.conf and add:

RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-proto_dist inet6_tcp"

If it doesn't work, please post what else there is in /etc/rabbitmq/rabbitmq-env.conf and the output of ifconfig, please