rabbitmq报错无法连接解决方案

最近在部署spring cloud分布式配置中心时,需要使用rabbitmq作为消息总线。连接的时候却各种报错,无法申明queue和exchange,被各种阻塞,找办法找了很久,最后发现rabbitmq连接应用的端口和控制台端口不一样,有点崩溃。

错误如:

java.net.SocketException: Socket Closed
at java.net.SocketInputStream.socketRead0

无法连接queue:

Failed to declare queue: Queue [name=springCloudBus.anonymous.TsJ-guK6TnWe1Ff-syaX3g, durable=false, autoDelete=true, exclusive=true, arguments={}], continuing... org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect

无法申明exchange:

Failed to declare exchange: Exchange [name=springCloudBus, type=topic, durable=true, autoDelete=false, internal=false, arguments={}], continuing... org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException

无法绑定:

Failed to declare binding: Binding [destination=springCloudBus.anonymous.TsJ-guK6TnWe1Ff-syaX3g, exchange=springCloudBus, routingKey=#], continuing... org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect

解决办法修改成应用访问端口号
其中15672是控制台端口号,而5672是应用访问端口号。
我们需要修改成5672

你可能感兴趣的:(rabbitmq报错,rabbitmq,无法连接rabbitmq,无法申明queu)