rabbitmq web管理页面无法访问

安装rabbitmq 之后可以通过默认的15672端口访问web界面进行管理,rabbitmq一些默认端口如下:

  • 4369: epmd, a peer discovery service used by RabbitMQ nodes and CLI tools
  • 5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
  • 25672: used by Erlang distribution for inter-node and CLI tools communication and is allocated from a dynamic range (limited to a single port by default, computed as AMQP port + 20000). See networking guide for details.
  • 15672: HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)
  • 61613, 61614: STOMP clients without and with TLS (only if the STOMP plugin is enabled)
  • 1883, 8883: (MQTT clients without and with TLS, if the MQTT plugin is enabled
  • 15674: STOMP-over-WebSockets clients (only if the Web STOMP plugin is enabled)
  • 15675: MQTT-over-WebSockets clients (only if the Web MQTT plugin is enabled)

    如果默认15672端口页面无法访问,先检查一下防火墙,添加端口或者关闭防火墙,centos6.5 关闭防火墙:

   [root@localhost ~]#servcie iptables stop --临时关闭防火墙,重启后复原

   [root@localhost ~]#chkconfig iptables off --永久关闭防火墙,重启后不会复原
   [root@localhost ~]# service iptables status  查看防火墙状态

  若关闭防火墙之后还是无法访问,则是由于在3.3.1和之后的版本,出于安全的考虑,guest这个默认的用户只能通过http://localhost:15672 登录,无法直接使用远程ip登录访问,需要进行配置,在配置之前先创建一个admin账号,并进行授权:

查看用户 :rabbitmqctl list_users

创建一个admin用户:rabbitmqctl add_user admin admin

用户授权 :rabbitmqctl set_user_tags admin administrator

              rabbitmqctl set_permissions -p / asdf ".*" ".*" ".*"

创建用户之后需要进行配置,若使用rpm安装,则修改配置/etc/rabbitmq/rabbitmq.config,配置内容大致如下:

[
{rabbit,
[%%
%% Network Connectivity
%% ====================
%%
%% By default, RabbitMQ will listen on all interfaces, using
%% the standard (reserved) AMQP port.
%%
{tcp_listeners, [5672]},
{loopback_users, ["admin"]}
]}
].

配置之后,如果rabbitmq无法正常启动,出现错误:

init terminating in do_boot ()

Crash dump is being written to: erl_crash.dump...done

此时有可能是配置文件配置有问题,确保配置文件没问题之后,重启即可。

 可参考官方文档:http://www.rabbitmq.com/access-control.html 

原文地址:https://www.cnblogs.com/jessezeng/p/6902542.html