RabbitMQ報錯:Error: unable to perform an operation on node 'rabbit@manage01'.

安裝完成之後問題描述:

1、打開http://ip:15672/#/ 後臺管理頁面會很慢
2、springboot項目連接mq經常連接不上(偶爾可以連上)
3、報錯:AmqpTimeoutException: java.util.concurrent.TimeoutException
4、java.net.SocketException: socket closed
5、An unexpected connection driver error occured

上面問題,網上很多資料都是設置用戶權限和允許遠程遠程訪問的方法:

設置用戶權限

rabbitmqctl  set_permissions -p /${user_name}  user_admin '.*' '.*' '.*'

允許遠程訪問,rabbitmq.config配置文件

[{rabbit, [{loopback_users, []}]}].

如果上訴方法不能解決的可以嘗試下面的方法:

1、運行如下命令查看狀態:

rabbitmqctl status

錯誤時會出現如下信息:

Status of node rabbit@manage01 ...
Error: unable to perform an operation on node 'rabbit@manage01'. 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@manage01
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

DIAGNOSTICS
===========

attempted to contact: [rabbit@manage01]

rabbit@manage01:
  * connected to epmd (port 4369) on manage01
  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic 
  * can't establish TCP connection to the target node, reason: timeout (timed out)
  * suggestion: check if host 'manage01' resolves, is reachable and ports 25672, 4369 are not blocked by firewall

Current node details:
 * node name: 'rabbitmqcli-27020-rabbit@manage01'
 * effective user's home directory: /var/lib/rabbitmq
 * Erlang cookie hash: cuIV6fAR5pI2DAISuXW4IQ==

正確時會出現如下信息:

Status of node rabbit@manage01 ...
[{pid,28714},
 {running_applications,
     [{rabbitmq_web_mqtt,"RabbitMQ MQTT-over-WebSockets adapter","3.7.12"},
      {rabbitmq_mqtt,"RabbitMQ MQTT Adapter","3.7.12"},
      {rabbitmq_management,"RabbitMQ Management Console","3.7.12"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.12"},
      {rabbitmq_web_stomp,"Rabbit WEB-STOMP - WebSockets to Stomp adapter",
          "3.7.12"},
      {rabbitmq_stomp,"RabbitMQ STOMP plugin","3.7.12"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.12"},
      {rabbit,"RabbitMQ","3.7.12"},
      {amqp_client,"RabbitMQ AMQP Client","3.7.12"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.12"},
      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},
      {xmerl,"XML parser","1.3.19"},
      {os_mon,"CPO  CXC 138 46","2.4.7"},
      {cowboy,"Small, fast, modern HTTP server.","2.6.1"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},
      {ssl,"Erlang/OTP SSL application","9.1.2"},
      {public_key,"Public key infrastructure","1.6.4"},
      {asn1,"The Erlang ASN1 compiler version 5.0.8","5.0.8"},
      {cowlib,"Support library for manipulating Web protocols.","2.7.0"},
      {crypto,"CRYPTO","4.4"},
      {inets,"INETS  CXC 138 49","7.0.5"},
      {sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},
      {mnesia,"MNESIA  CXC 138 12","4.15.5"},
      {recon,"Diagnostic tools for production use","2.3.6"},
      {lager,"Erlang logging framework","3.6.5"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.3.1"},
      {syntax_tools,"Syntax tools","2.1.6"},
      {sasl,"SASL  CXC 138 11","3.3"},
      {stdlib,"ERTS  CXC 138 10","3.7.1"},
      {kernel,"ERTS  CXC 138 10","6.2"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:128] [hipe]\n"},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,16596},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,972316},
      {other_proc,31715356},
      {metrics,206948},
      {mgmt_db,161864},
      {mnesia,74376},
      {other_ets,2853712},
      {binary,94816},
      {msg_index,28784},
      {code,23713613},
      {atom,1172689},
      {other_system,14120482},
      {allocated_unused,15029600},
      {reserved_unallocated,0},
      {strategy,rss},
      {total,[{erlang,75131552},{rss,78036992},{allocated,90161152}]}]},
 {alarms,[]},
 {listeners,
     [{clustering,25672,"::"},
      {amqp,5672,"::"},
      {stomp,61613,"::"},
      {'http/web-stomp',15674,"::"},
      {http,15672,"::"},
      {mqtt,1883,"::"},
      {'http/web-mqtt',15675,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,13390166425},
 {disk_free_limit,50000000},
 {disk_free,22576242688},
 {file_descriptors,
     [{total_limit,32668},
      {total_used,2},
      {sockets_limit,29399},
      {sockets_used,0}]},
 {processes,[{limit,1048576},{used,463}]},
 {run_queue,1},
 {uptime,26},
 {kernel,{net_ticktime,60}}]

我們只需要關注第一句話:

Status of node rabbit@manage01 ...

可以知道rabbitmq中的host是manage01,然後運行如下命令添加host配置即可:

echo 127.0.0.1 manage01 >> /etc/host

PS:127.0.0.1可以是你的IP具體地址,如果是局域網服務器,可以直接寫內網地址。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章