【问题标题】:Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused无法连接到 amqp://guest:**@127.0.0.1:5672//: [Errno 111] 连接被拒绝
【发布时间】:2018-10-24 21:56:31
【问题描述】:

我在 CentOS 上使用带有 Django 1.8 的 RabbitMQ 服务器。当我重新启动 rabbitmq-server 时,操作完成并显示消息“restart ok”。但是当我看到状态时,它显示以下输出:

Starting node rabbit@bynrySystem ...
Error: unable to connect to node rabbit@bynrySystem: nodedown

DAIGNOSTICS
===========

attempted to contact: [rabbit@bynrySystem]

rabbit@bynrySystem:
  * connected to epmd (port 4369) on bynrySystem
  * epmd reports: node 'rabbit' not running at all
                  no other nodes on bynrySystem
  * suggestion: start the node

current node details:
- node name: 'rabbitmq-cli-59@bynrySystem'
- home dir: /var/lib/rabbitmq
- cookie hash: f/MoFCCKTONVCYhIDLxvew==

When I run a task it gives following error.

consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.

【问题讨论】:

    标签: django python-2.7 rabbitmq celery


    【解决方案1】:

    此错误的常见原因是关闭后 cookie 哈希设置不正确。如果您的 RabbitMQ 节点中没有任何有价值的数据或定义,只需停止服务并删除 /var/lib/rabbitmq/*,然后重新启动它。

    sudo rm -rf /var/lib/rabbitmq/*
    

    重置节点,因此它会删除所有消息。

    【讨论】:

    • 它会删除交换中的所有消息吗?
    • @ANDY_VAR YES(消息在队列中,而不是“在”交换中)
    • 对我不起作用。我的配置一直在工作,但不确定是什么导致它停止工作。通过这个建议的修复,我仍然看到。[2019-11-12 22:36:27,102: ERROR/MainProcess] 消费者:无法连接到 amqp://guest:**@127.0.0.1:5672//: [Errno 111]连接被拒绝。 8.00 秒后重试……16 秒……等等
    • @zerocog 您的错误可能只是服务器未运行且与 OP 问题无关。
    • 这个错误是因为我的 libcrypto 版本在更新后不匹配。我重新安装了,然后 libcrypto 是正确的,rabbitmqctl 再次工作。如果我所做的完全有效,那么我可能会添加一个答案以重新安装 rabbit 以获取 openssl 同步。
    【解决方案2】:

    对我有用的是 rabbitmqctl 重置

    rabbitmqctl stop_app
    rabbitmqctl reset
    rabbitmqctl start_app
    rabbitmqctl list_users
    

    导致

    Listing users ...
    guest   [administrator]
    

    参考enter link description here

    这适用于默认配置。但是,创建一个具有访问该虚拟主机权限的用户的虚拟主机似乎是一种更好的做法。

    【讨论】:

      猜你喜欢
      • 2020-06-07
      • 2023-01-10
      • 2020-03-12
      • 2017-11-26
      • 2020-12-30
      • 2014-11-30
      • 2018-02-23
      • 2017-08-22
      相关资源
      最近更新 更多