【问题标题】:AMQP Closing all channels from connection when pun up port 5672AMQP 在打开端口 5672 时从连接中关闭所有通道
【发布时间】:2021-07-03 20:49:40
【问题描述】:

我已将 Rabbitmq 作为 docker compose 运行,它在浏览器上的端口 15672 上运行良好,但 5672 不工作。

docker-compose

rabbitmq:
    image: 'rabbitmq:3-management-alpine'
    container_name: rabbitmq
    ports:
      - '5672:5672'
      - '15672:15672'
    environment:
      - RABBITMQ_NODE_TYPE=stats
      - RABBITMQ_NODE_NAME=rabbit@stats
      - RABBITMQ_ERL_COOKIE=s3cr3tc00ki3
      - RABBITMQ_DEFAULT_USER=rabbitmquser
      - RABBITMQ_DEFAULT_PASS=rabbitmquser
    volumes:
      - '/rabbitmq/data:/var/lib/rabbitmq/'
      - '/rabbitmq/log:/var/log/rabbitmq'

spring application.properties

spring.rabbitmq.host = 192.168.1.212
spring.rabbitmq.port = 15672
spring.rabbitmq.username = rabbitmquser
spring.rabbitmq.password = rabbitmquser

输入http://192.168.100.12:5672时docker日志出错

2021-04-07 13:30:07.742 [info] <0.731.0> Resetting node maintenance status
2021-04-07 13:31:27.979 [info] <0.1050.0> accepting AMQP connection <0.1050.0> (192.168.2.2:62786 -> 172.19.0.4:5672)
2021-04-07 13:31:28.093 [error] <0.1050.0> closing AMQP connection <0.1050.0> (192.168.2.2:62786 -> 172.19.0.4:5672):
{bad_header,<<"GET / HT">>}
2021-04-07 13:31:28.111 [info] <0.1055.0> Closing all channels from connection '192.168.2.2:62786 -> 172.19.0.4:5672' because it has been closed
2021-04-07 13:31:29.224 [info] <0.1053.0> accepting AMQP connection <0.1053.0> (192.168.2.2:62787 -> 172.19.0.4:5672)
2021-04-07 13:31:29.225 [error] <0.1053.0> closing AMQP connection <0.1053.0> (192.168.2.2:62787 -> 172.19.0.4:5672):
{bad_header,<<"GET / HT">>}
2021-04-07 13:31:29.228 [info] <0.1062.0> Closing all channels from connection '192.168.2.2:62787 -> 172.19.0.4:5672' because it has been closed
2021-04-07 13:31:34.276 [info] <0.1060.0> accepting AMQP connection <0.1060.0> (192.168.2.2:62789 -> 172.19.0.4:5672)
2021-04-07 13:31:34.280 [error] <0.1060.0> closing AMQP connection <0.1060.0> (192.168.2.2:62789 -> 172.19.0.4:5672):
{bad_header,<<"GET / HT">>}
2021-04-07 13:31:34.282 [info] <0.1069.0> Closing all channels from connection '192.168.2.2:62789 -> 172.19.0.4:5672' because it has been closed
2021-04-07 13:31:44.279 [info] <0.1067.0> accepting AMQP connection <0.1067.0> (192.168.2.2:62790 -> 172.19.0.4:5672)
2021-04-07 13:31:44.280 [error] <0.1067.0> closing AMQP connection <0.1067.0> (192.168.2.2:62790 -> 172.19.0.4:5672):
{handshake_timeout,handshake}
2021-04-07 13:31:44.282 [info] <0.1073.0> Closing all channels from connection '192.168.2.2:62790 -> 172.19.0.4:5672' because it has been closed

春季出错

declaring queue for inbound: springCloudBus.anonymous.PRr6HWmwTqGU2akit5Rc9Q, bound to: springCloudBus
Attempting to connect to: [192.168.1.212:15672]
Channel 'springCloudBus.anonymous.PRr6HWmwTqGU2akit5Rc9Q.errors' has 1 subscriber(s).
Broker not available; cannot force queue declarations during start: java.net.ConnectException: Connection timed out: no further information
onsumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: no further information

【问题讨论】:

  • 乍一看,您的端口看起来很混乱。 15672 是您经纪人的默认门户网站; 5672 是 AMPQ(又名 rabbit)客户端的默认端口。我猜你应该有这个:spring.rabbitmq.port = 5672
  • 您无法通过网络查看http://192.168.100.12:5672。这就是15672 的用途。
  • spring.rabbitmq.port = 5672 正在工作。谢谢@JevonKendon 的帮助。
  • 谢谢。请标记答案并设置为已回答。干杯。

标签: spring docker rabbitmq spring-rabbit


【解决方案1】:

变化:

spring.rabbitmq.port = 5672

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-10
    • 2014-02-09
    相关资源
    最近更新 更多