我已经运行rabbitmq作为一个docker组件,它与浏览器上的端口15672很好地工作,但5672不工作。
Docker
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应用程序.properties
spring.rabbitmq.host = 192.168.1.212
spring.rabbitmq.port = 15672
spring.rabbitmq.username = rabbitmquser
spring.rabbitmq.password = rabbitmquser
输入时docker日志出错http://192.168.100.12:5672
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
Spring误差
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
1条答案
按热度按时间taor4pac1#
更改: