erlang Rabbitmq监听所有接口

t3psigkw  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(187)

看起来我的rabbitmq监听所有接口,尽管:
在/etc/rabbitmq/rabbitmq.config中,您可以执行以下操作:

[{rabbit, [{tcp_listeners, [{"10.0.0.1", 5672}]}]},
  {rabbitmq_mochiweb, [{listeners, [{mgmt, [{ip, "10.0.0.1"},
                                            {port, 55672}]}]}]}].

在/etc/rabbitmq/rabbitmq-env.conf文件中:

export RABBITMQ_NODENAME=rabbit
export RABBITMQ_NODE_IP_ADDRESS=10.0.0.1
export ERL_EPMD_ADDRESS=10.0.0.1

当我运行 netstat -uptan时|grep beam 我得到:

tcp        0      0 10.0.0.1:5672           0.0.0.0:*               LISTEN      1378/beam
tcp        0      0 0.0.0.0:33551           0.0.0.0:*               LISTEN      1378/beam
tcp        0      0 127.0.0.1:38737         127.0.0.1:4369          ESTABLISHED 1378/beam

如何使 beam 不在 0.0.0.0:33551 上侦听?

xam8gpfp

xam8gpfp1#

tcp 0 0 127.0.0.1:38737 127.0.0.1:4369 ESTABLISHED 1378/beam says that beam process enables Erlang distributed protocol and connected to epmd daemon on 127.0.0.1:4369 . Also beam process waits for incoming connections on 0.0.0.0:33551 . This interface secured with Erlang cookies and rabbitmqctl uses it to connect to RabbitMQ instance and manage it.
To make it able to accept connections only from localhost you can:

  • use -kernel inet_dist_use_interface '{127,0,0,1}'kernel configuration flag from shell or create my_rabbitmq.conf:

[{kernel,[{inet_dist_use_interface,{127,0,0,1}}]}].
and use RabbitMQ environment variable to include it: export RABBITMQ_CONFIG_FILE="/path/to/my_rabbitmq.conf" to use configuration file

相关问题