RabbitMQ server appears to ignore config file values (even though logs show that it finds it)

1,099 views
Skip to first unread message

Alex Meuer

unread,
May 15, 2019, 7:28:52 AM5/15/19
to rabbitmq-users
I've found many many posts and questions regarding RabbitMQ not finding the config file, that's not my issue.

RabbitMQ can find the config file just fine:
2019-05-15 12:18:01.118 [info] <0.279.0>
 Starting RabbitMQ 3.7.14 on Erlang 21.3.7.1
 Copyright (C) 2007-2019 Pivotal Software, Inc.
 Licensed under the MPL.  See https://www.rabbitmq.com/
2019-05-15 12:18:01.119 [info] <0.279.0>
 node           : rabbit@localhost
 home dir       : /Users/alex
 config file(s) : /usr/local/etc/rabbitmq/rabbitmq.conf
 cookie hash    : ZwCfPYOkaCcH5F36xnmuhg==
 log(s)         : /usr/local/var/log/rabbitmq/rab...@localhost.log
                : /usr/local/var/log/rabbitmq/rabbit@localhost_upgrade.log
 database dir   : /usr/local/var/lib/rabbitmq/mnesia/rabbit@localhost
It will even crash on start if the syntax is wrong in the config file.

However, I'm trying to open up the server to the network, so I've downloaded the example config and set it up so that the server should accept connections form anywhere:
## Networking
## ====================
##
##
## By default, RabbitMQ will listen on all interfaces, using
## the standard (reserved) AMQP 0-9-1 and 1.0 port.
##
# listeners.tcp.default = 5672
listeners.tcp.1 = 0.0.0.0:5672
listeners.tcp.2 = :::5672

## To listen on a specific interface, provide an IP address with port.
## For example, to listen only on localhost for both IPv4 and IPv6:
##
# IPv4
# listeners.tcp.local    = 127.0.0.1:5672
# IPv6
# listeners.tcp.local_v6 = ::1:5672

## You can define multiple listeners using listener names
# listeners.tcp.other_port = 5673
# listeners.tcp.other_ip   = 10.10.10.10:5672
I also tried omitting the ip address from my values above and just leaving it as '5672' but there was no effect.

In the logs, however, it only shows that it's listening on localhost (as well as default MQTT and STOMP ports) and not on the values specified in the config file.
I'm really stumped as to why it'll crash if the config file syntax is wrong but still won't use the values in it...


Daniil Fedotov

unread,
May 15, 2019, 10:37:59 AM5/15/19
to rabbitmq-users
Hi,

Does rabbitmq start successfully with this config? Because it's supposed to fail. Two listeners should not be able to use the same port.
Message has been deleted

Luke Bakken

unread,
May 15, 2019, 10:47:14 AM5/15/19
to rabbitmq-users
Hi Alex -

Daniil is 100% correct. If you use the following configuration ...

listeners.tcp.1 = 0.0.0.0:5672
listeners.tcp.2 = :::5672

You will see this error:

2019-05-15 07:39:43.707 [error] <0.432.0> Failed to start Ranch listener {acceptor,{0,0,0,0},5672} in ranch_tcp:listen([{cacerts,'...'},{key,'...'},{cert,'...'},{port,5672},{ip,{0,0,0,0}},inet,{backlog,128},{nodelay,true},{linger,{true,0}},{exit_on_close,false}]) for reason eaddrinuse (address already in use)
2019-05-15 07:39:43.707 [error] <0.304.0> Failed to start TCP listener [0.0.0.0]:5672, error: eaddrinuse

If your intent is to listen on all IPv4 and IPv6 interfaces, you should define just one listener on IPv6:

listeners.tcp.default = :::5672

Since IPv4 is a subset of IPv6, the above will work. I tested it locally using netstat and nc:

$ netstat -pan|fgrep 567
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      29803/beam.smp      
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      29803/beam.smp      
tcp6       0      0 :::5672                 :::*                    LISTEN      29803/beam.smp 

$ nc -4 192.168.1.5 5672

RabbitMQ logs this expected error:

(rabbit@shostakovich)1> 2019-05-15 07:42:13.473 [info] <0.604.0> accepting AMQP connection <0.604.0> (192.168.1.5:62970 -> 192.168.1.5:5672)
2019-05-15 07:42:13.473 [error] <0.604.0> closing AMQP connection <0.604.0> (192.168.1.5:62970 -> 192.168.1.5:5672):
{handshake_timeout,handshake}
                                                                                                                                                                                                                                                    
$ nc -6 ::1 5672

RabbitMQ logs this expected error:

(rabbit@shostakovich)1> 2019-05-15 07:42:39.924 [info] <0.608.0> accepting AMQP connection <0.608.0> ([::1]:22592 -> [::1]:5672)
2019-05-15 07:42:39.924 [error] <0.608.0> closing AMQP connection <0.608.0> ([::1]:22592 -> [::1]:5672):
{handshake_timeout,handshake}

Thanks,
Luke
Message has been deleted

Luke Bakken

unread,
May 15, 2019, 12:29:56 PM5/15/19
to rabbitm...@googlegroups.com
Hi Alex,

I never use homebrew to install RabbitMQ on OS X, and the RabbitMQ
team does not maintain that package. I think the generic-unix build is
a better option and is what I use.

In any case, you should be able to find the configuration files that
get generated from rabbitmq.conf in
/usr/local/var/lib/rabbitmq/config/generated -

-rw-r--r-- 1 lbakken lbakken 201 May 15 07:40 rabbitmq.config
-rw-r--r-- 1 lbakken lbakken 7 May 15 07:40 vm.2019.05.15.07.40.49.args

If you can attach the rabbitmq.config and vm.*.args file, that could
give us a hint. If those files aren't present, something is broken
with the homebrew package.

Thanks,
Luke

On Wed, May 15, 2019 at 9:24 AM Alex Meuer <al...@yaku.to> wrote:
>
> Odd. I'm not getting that error, even though the log file shows that it has found the config file.
>
> I changed the config to match what you said but I'm not seeing any change. The log still shows that it's starting the tcp listener on 127.0.0.1:5672.
>
> Netstat doesn't show anything for port 5672 and nothing turns up in the rabbitmq log for netcat either (RabbitMQ-server is running, and I have restarted it every time I changed the config file).
>
> config file(s) : /usr/local/etc/rabbitmq/rabbitmq.conf

Michael Klishin

unread,
May 15, 2019, 1:29:27 PM5/15/19
to rabbitmq-users
FTR, the Homebrew RabbitMQ formula does use our generic UNIX binary build. What it adds on top is
configuration, directory locations and so on. That's not necessarily wrong, just makes the environment less predictable if you are familiar with
other deployment options.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Alex Meuer

unread,
May 16, 2019, 5:22:31 AM5/16/19
to rabbitmq-users

Michael Klishin

unread,
May 16, 2019, 8:42:08 AM5/16/19
to rabbitmq-users
Homebrew's RabbitMQ formula overrides config file location [1]. My best guess is that there is a default.
When you have two files (e.g. a rabbitmq.config and rabbitmq.conf), the behavior can be surprising :)

Looks like they use `/etc/rabbitmq/rabbitmq-env.conf` for the environment variable file, perhaps modifying config file path there
would be sufficient.

In any case, you are running the same package as the formula, so if it makes it easier for you to run it directly, why not :)


To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/5e4f27d1-c6f7-42ce-b9fa-10e1e867a087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages