更新时间:2022-08-15 GMT+08:00
RabbitMQ客户端连接报错原因分析
RabbitMQ客户端连接失败,可能原因包括地址、端口填错、用户名或者密码填错、超过最大连接数。
- 连接地址不正确
VPC内访问场景下,连接地址不正确时,报错如下:
[root@ecs-heru RabbitMQ-Tutorial]# java -cp .:rabbitmq-tutorial.jar Send 192.168.125.110 5672 user ******* Exception in thread "main" java.net.NoRouteToHostException: No route to host (Host unreachable) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
公网访问场景下,连接地址不正确时,报错如下:
[root@ecs-heru RabbitMQ-Tutorial]# java -cp .:rabbitmq-tutorial.jar Send 139.xxx.178 5672 user ******* Exception in thread "main" java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
- 端口不正确
VPC内访问场景下,端口不正确时,报错如下:
[root@ecs-heru RabbitMQ-Tutorial]# java -cp .:rabbitmq-tutorial.jar Send 192.168.125.111 5673 user ******* Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
公网访问场景下,端口不正确时,报错如下:
[root@ecs-heru RabbitMQ-Tutorial]# java -cp .:rabbitmq-tutorial.jar Send 139.xxx.179 5673 user ******* Exception in thread "main" java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
- 用户名或密码错误
[root@ecs-heru RabbitMQ-Tutorial]# java -cp .:rabbitmq-tutorial.jar Send 192.168.125.111 5672 user ******* Exception in thread "main" com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile. at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:351) at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64)
- 超过最大连接数
父主题: 连接问题