[rabbitmq-discuss] Identifying TCP Listeners.

Matthias Radestock matthias at rabbitmq.com
Tue Apr 17 12:14:53 BST 2012


Adam,

On 17/04/12 11:10, Adam Tauno Williams wrote:
>> export ERL_EPMD_DIST_BIND=172.0.0.1
>
> This variable doesn't effect what ports are opened.

Serves me right for believing what it says on the internet. The correct 
env var is ERL_EPMD_ADDRESS. Apologies.

> I added ". /etc/sysconfig/rabbitmq" to the startup file and that file
> contains:
>
> export ERL_EPMD_DIST_BIND=127.0.0.1
>
> Something&  Erlang still opens all interfaces:
>
> tcp  0.0.0.0:4369       0.0.0.0:*   LISTEN      32571/epmd
> tcp  127.0.0.1:55672    0.0.0.0:*   LISTEN      32603/beam.smp
> tcp  0.0.0.0:52445      0.0.0.0:*   LISTEN      32603/beam.smp
> tcp  127.0.0.1:5672     0.0.0.0:*   LISTEN      32603/beam.smp
>
> The config has managed to restric rabbit's service as well as the
> management interface.
>
> rabbitmq-server-2.7.0-1.suse.noarch
> Linux 3.1.0-1.2-desktop
>
> workstation:~ # cat /etc/rabbitmq/rabbitmq.config
> [
>    {rabbit,        {tcp_listeners,               [{'127.0.0.1',5672}]},
>                    {collect_statistics_interval, 10000} ] },
>    {rabbitmq_management,  [ {http_log_dir,   "/tmp/rabbit-mgmt"} ] },
>    {rabbitmq_management_agent, [ {force_fine_statistics, true} ] },
>    {rabbitmq_mochiweb, [ {listeners, [{mgmt, [{port, 55672},
>                                               {ip, "127.0.0.1"}]}]},
>                          {default_listener, [{port, 60000} ] } ] }
> ].

The above cannot possibly be the config file that is actually being used 
since it is syntactically invalid and causes rabbit to fail to start.

Anyway, here's what I did to affect an address change. Please follow 
these steps EXACTLY...

1) stop any running rabbit and other erlang processes. Verify this by 
checking that there are no beam.smp processes left running.

2) stop any running epmd processes with 'epmd -kill'. Verify this by 
checking that there are no epmd processes left running.

3) put the following in /etc/rabbitmq/rabbitmq.config

[{kernel, [{inet_dist_use_interface, {127,0,0,1}}]},
  {rabbit, [{tcp_listeners, [{"127.0.0.1", 5672}]}]},
  {rabbitmq_mochiweb, [{listeners, [{mgmt, [{ip, "127.0.0.1"},
                                            {port, 55672}]}]}]}].

4) put the following in /etc/rabbitmq/rabbitmq-env.conf

export ERL_EPMD_ADDRESS=127.0.0.1

5) start rabbit

6) verify that the config file has been read by inspecting the startup log

7) check what interfaces are being listened on

$ sudo netstat -lpn | grep epmd
tcp  0  0 127.0.0.1:4369   0.0.0.0:*  LISTEN  716/epmd
$ sudo netstat -lpn | grep beam
tcp  0  0 127.0.0.1:45011  0.0.0.0:*  LISTEN  702/beam.smp
tcp  0  0 127.0.0.1:55672  0.0.0.0:*  LISTEN  702/beam.smp
tcp  0  0 127.0.0.1:5672   0.0.0.0:*  LISTEN  702/beam.smp


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list