{
  "id": "communication/rabbitmq-connection-refused-ec2",
  "signature": "AMQPConnectionError: connection refused (111) to rabbitmq-host:5672",
  "signature_zh": "AMQPConnectionError：连接到 rabbitmq-host:5672 被拒绝（111）",
  "regex": "connection refused.*:5672",
  "domain": "communication",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The AMQP client cannot establish a TCP connection to the RabbitMQ server because the server is not listening on the specified port, the service is down, or a firewall/security group is blocking inbound traffic.",
  "root_cause_type": "generic",
  "root_cause_zh": "AMQP 客户端无法与 RabbitMQ 服务器建立 TCP 连接，因为服务器未在指定端口上监听、服务已关闭，或防火墙/安全组阻止了入站流量。",
  "versions": [
    {
      "version": "RabbitMQ 3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Erlang 26",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Pika 1.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "amqp-node 0.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Change the RabbitMQ username and password in the client",
      "why_fails": "Changing the RabbitMQ user credentials does not fix the connection refusal because the TCP handshake fails before any authentication occurs.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the AMQP connection timeout to 60 seconds",
      "why_fails": "Increasing the connection timeout does not help because the error is immediate (connection refused), not a timeout.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable TLS/SSL on the AMQP client connection",
      "why_fails": "Enabling TLS on the client without configuring the server to accept TLS on the same port will still result in connection refusal or a different error.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check if RabbitMQ is running: `systemctl status rabbitmq-server` or `rabbitmqctl status`. If not running, start it: `systemctl start rabbitmq-server`.",
      "success_rate": 0.8,
      "how": "Check if RabbitMQ is running: `systemctl status rabbitmq-server` or `rabbitmqctl status`. If not running, start it: `systemctl start rabbitmq-server`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Verify firewall rules: on Linux, run `sudo ufw status` or `iptables -L -n | grep 5672`. Ensure inbound TCP on port 5672 is allowed. For cloud providers, check security group inbound rules for the instance.",
      "success_rate": 0.75,
      "how": "Verify firewall rules: on Linux, run `sudo ufw status` or `iptables -L -n | grep 5672`. Ensure inbound TCP on port 5672 is allowed. For cloud providers, check security group inbound rules for the instance.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If RabbitMQ is listening on a different interface (e.g., localhost only), update the config file `/etc/rabbitmq/rabbitmq.conf` to bind to `0.0.0.0` or the correct IP: `listeners.tcp.default = 0.0.0.0:5672`. Restart RabbitMQ after changes.",
      "success_rate": 0.7,
      "how": "If RabbitMQ is listening on a different interface (e.g., localhost only), update the config file `/etc/rabbitmq/rabbitmq.conf` to bind to `0.0.0.0` or the correct IP: `listeners.tcp.default = 0.0.0.0:5672`. Restart RabbitMQ after changes.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check if RabbitMQ is running: `systemctl status rabbitmq-server` or `rabbitmqctl status`. If not running, start it: `systemctl start rabbitmq-server`.",
    "Verify firewall rules: on Linux, run `sudo ufw status` or `iptables -L -n | grep 5672`. Ensure inbound TCP on port 5672 is allowed. For cloud providers, check security group inbound rules for the instance.",
    "If RabbitMQ is listening on a different interface (e.g., localhost only), update the config file `/etc/rabbitmq/rabbitmq.conf` to bind to `0.0.0.0` or the correct IP: `listeners.tcp.default = 0.0.0.0:5672`. Restart RabbitMQ after changes."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.rabbitmq.com/docs/connection#connection-refused",
  "official_doc_section": null,
  "error_code": "111",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-04-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}