1、首先确定linux上的iptables是否把相关端口禁了。service iptables stop停掉试试。
2、rabbitmq 添加远程访问功能
3.3.1版中,处于安全的考虑,guest这个默认的用户只能通过http://localhost:15672 来登录,其他的IP无法直接使用这个账号。 这对于服务器上没有安装桌面的情况是无法管理维护的,除非通过在前面添加一层代理向外提供服务,这个又有些麻烦了,这里通过配置文件来实现这个功能。
只要编辑 /etc/rabbitmq/rabbitmq.config 文件,添加以下配置就可以了。
[
{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["asdf"]}]}
].
现在添加了一个新授权用户asdf,可以通过外网使用这个用户名和密码访问.(记得要先用命令添加这个命令才行, #rabbitmqctl add_user asdf 123456)我是通过在管理平台里直接添加的用户和密码的,我的测试环境装有桌面的。
我用rpm包安装的rabbitmq,所以提供默认的配置参考文件,如果你使用源码编译的话,可以找到一个默认的配置文件rabbitmq.config.example,点击这里下载此文件rabbitmq.config
=================================rabbitmq.config=============================
%% -*- mode: erlang -*- %% ---------------------------------------------------------------------------- %% RabbitMQ Sample Configuration File. %% %% See http://www.rabbitmq.com/configure.html for details. %% ---------------------------------------------------------------------------- [ {rabbit, [%% %% Network Connectivity %% ==================== %% %% By default, RabbitMQ will listen on all interfaces, using %% the standard (reserved) AMQP port. %% %% {tcp_listeners, [5672]}, %% To listen on a specific interface, provide a tuple of {IpAddress, Port}. %% For example, to listen only on localhost for both IPv4 and IPv6: %% %% {tcp_listeners, [{"127.0.0.1", 5672}, %% {"::1", 5672}]}, %% SSL listeners are configured in the same fashion as TCP listeners, %% including the option to control the choice of interface. %% %% {ssl_listeners, [5671]}, %% Log levels (currently just used for