linux环境下rabbitmqctl status报错 Error: unable to perform an operation on node 'rabbit@c1'.的最新解决方案

原创 创建时间:2019-03-04 访问量:3813 赞:1 踩:1

安装后执行rabbitctl status或rabbitctl list_users都报错

Error: unable to perform an operation on node 'rabbit@c1'.

按照网上的步骤安装完rabbitmq后,启动rabbitmq-server:

> rabbitmq-server

##  ##

  ##  ##      RabbitMQ 3.7.9. Copyright (C) 2007-2018 Pivotal Software, Inc.

  ##########  Licensed under the MPL.  See http://www.rabbitmq.com/

  ######  ##

  ##########  Logs: /opt/app/rabbitmq_server-3.7.9/var/log/rabbitmq/rabbit@c1.log

                    /opt/app/rabbitmq_server-3.7.9/var/log/rabbitmq/rabbit@c1_upgrade.log

              Starting broker...

 completed with 0 plugins.

启动成功,然后执行rabbitctl status,报错如下:

Status of node rabbit@c2 ...

Error: unable to perform an operation on node 'rabbit@c2'. Please see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)

 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)

 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more

 * Consult server logs on node rabbit@c1

DIAGNOSTICS

===========

attempted to contact: [rabbit@c2]

rabbit@c2:

  * unable to connect to epmd (port 4369) on c2: nxdomain (non-existing domain)

Current node details:

 * node name: 'rabbitmqcli-44890-rabbit@c1'

 * effective user's home directory: /home/zhouxiang

 * Erlang cookie hash: Enx3Zy0uLjvqzkiXDEpm9Q==


网上都在说明.erlang.cookie不一致造成的,在Linux系统中,有两个地方有这个文件,分别是:

/home/oscar/.erlang.cookie

/var/lib/rabbitmq/.erlang.cookie

一个是home目录,另一个是/var/lib/rabbitmq目录下。查了一个这两个确实不一样,但是我把它们换成一样的话还是不行,于是我又还原了加来。

发现问题:

错误信息中有句话值得思考:Consult server logs on node rabbit@c1。

这个c1应该是我的hostname,后来想一下不对,我的hostname是c1.oscar.com。后面我用-n指定节点,又报错说,只能以hostname第一个数作为节点也就是c1。也就是说,我这种hostname命名规则在使用rabbitmq时要小心。

rabbitmqctl -n rabbit@c1.oscar.com status 这个操作也不行,只能用@c1。

后来就将c1写到了hosts中去了。如下:

> sudo vi /etc/hosts

在文件中加

192.168.133.134 c1.oscar.com c1

就是在之前的配置192.168.133.134 c1.oscar.com后面加了一个c1。就将c1也与192.168.133.134映射了一下。保存,source /etc/hosts。

然后再次执行rabbitmqctl status就可以了。显示如下所示:

Status of node rabbit@c1 ...

[{pid,44578},

 {running_applications,

     [{rabbit,"RabbitMQ","3.7.9"},

      {rabbit_common,

          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",

          "3.7.9"},

      {mnesia,"MNESIA  CXC 138 12","4.15.5"},

      {ranch_proxy_protocol,"Ranch Proxy Protocol Transport","2.1.1"},

      {ranch,"Socket acceptor pool for TCP protocols.","1.6.2"},

      {ssl,"Erlang/OTP SSL application","9.0.2"},

      {public_key,"Public key infrastructure","1.6.2"},

      {asn1,"The Erlang ASN1 compiler version 5.0.7","5.0.7"},

      {crypto,"CRYPTO","4.3.3"},

      {recon,"Diagnostic tools for production use","2.3.6"},

      {os_mon,"CPO  CXC 138 46","2.4.6"},

      {inets,"INETS  CXC 138 49","7.0.2"},

      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},

      {xmerl,"XML parser","1.3.18"},

      {lager,"Erlang logging framework","3.6.5"},

      {goldrush,"Erlang event stream processor","0.1.9"},

      {compiler,"ERTS  CXC 138 10","7.2.5"},

      {syntax_tools,"Syntax tools","2.1.6"},

      {sasl,"SASL  CXC 138 11","3.2.1"},

      {stdlib,"ERTS  CXC 138 10","3.6"},

      {kernel,"ERTS  CXC 138 10","6.1"}]},

 {os,{unix,linux}},

 {erlang_version,

     "Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:64] [hipe]\n"},

 {memory,

     [{connection_readers,0},

      {connection_writers,0},

      {connection_channels,0},

      {connection_other,0},

      {queue_procs,0},

      {queue_slave_procs,0},

      {plugins,13788},

      {other_proc,32140184},

      {metrics,195292},

      {mgmt_db,0},

      {mnesia,72736},

      {other_ets,2338384},

      {binary,133768},

      {msg_index,30384},

      {code,20446119},

      {atom,1082561},

      {other_system,11177536},

      {allocated_unused,15112544},

      {reserved_unallocated,0},

      {strategy,rss},

      {total,[{erlang,67630752},{rss,73293824},{allocated,82743296}]}]},

 {alarms,[]},

 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},

 {vm_memory_calculation_strategy,rss},

 {vm_memory_high_watermark,0.4},

 {vm_memory_limit,1582507622},

 {disk_free_limit,50000000},

 {disk_free,40342499328},

 {file_descriptors,

     [{total_limit,924},{total_used,2},{sockets_limit,829},{sockets_used,0}]},

 {processes,[{limit,1048576},{used,209}]},

 {run_queue,1},

 {uptime,18},

 {kernel,{net_ticktime,60}}]


本文由IT资源技术共享社区工联信息网原创。

评论
 我想说:
==已经到底了==
关注: 粉丝: 积分:
工联信息网
如有问题请致邮箱:need@glxxw2018.com(仅限本站无法查询到的资料);本站能够查询到的资料请关注“工联信息网”公众号,通过页面提供的资源码查询!
不良信息反馈及侵权投诉建议请致邮箱:accusation@glxxw2018.com