gpt4 book ai didi

amazon-ec2 - 获取 Rabbitmq HeartBeat 异常

转载 作者:行者123 更新时间:2023-12-05 06:35:42 25 4
gpt4 key购买 nike

我遇到了 rabbitmq 的一个问题,它终止了以下异常的连接

 {"message":"com.rabbitmq.client.AlreadyClosedException: connection is already closed due to connection error; cause: com.rabbitmq.client.MissedHeartbeatException: Heartbeat missing with heartbeat = 60 seconds"}

所以我正在使用以下配置:-

  1. 带有 t2_small 服务器的 aws ec2-instance1 上的 Rabbitmq docker。

  2. 面临此问题的服务在带有 t2-small 服务器的 aws ec2-instance2 上运行。

  3. 为rabbitmq设置如下配置

  factory.setAutomaticRecoveryEnabled(true);
factory.setNetworkRecoveryInterval(1000);
factory.setRequestedHeartbeat(60);

我只是无法理解出现此类错误的原因是什么,我们该如何解决这个问题。

我还在下面找到了试图与 rabbitmq 连接的服务的日志

{"log":"Caught an exception during connection recovery!\n","stream":"stderr","time":"2018-03-22T00:00:00.632851865Z"} {"log":"java.net.NoRouteToHostException: No route to host\n","stream":"stderr","time":"2018-03-22T00:00:00.633374123Z"} {"log":"\u0009at java.net.PlainSocketImpl.socketConnect(Native Method)\n","stream":"stderr","time":"2018-03-22T00:00:00.633666158Z"} {"log":"\u0009at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)\n","stream":"stderr","time":"2018-03-22T00:00:00.633935828Z"} {"log":"\u0009at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)\n","stream":"stderr","time":"2018-03-22T00:00:00.634170787Z"} {"log":"\u0009at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)\n","stream":"stderr","time":"2018-03-22T00:00:00.63440824Z"} {"log":"\u0009at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)\n","stream":"stderr","time":"2018-03-22T00:00:00.634625637Z"} {"log":"\u0009at java.net.Socket.connect(Socket.java:589)\n","stream":"stderr","time":"2018-03-22T00:00:00.635038038Z"} {"log":"\u0009at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)\n","stream":"stderr","time":"2018-03-22T00:00:00.635172903Z"} {"log":"\u0009at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:34)\n","stream":"stderr","time":"2018-03-22T00:00:00.635369445Z"} {"log":"\u0009at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConnection(AutorecoveringConnection.java:435)\n","stream":"stderr","time":"2018-03-22T00:00:00.635639932Z"} {"log":"\u0009at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.beginAutomaticRecovery(AutorecoveringConnection.java:407)\n","stream":"stderr","time":"2018-03-22T00:00:00.63584649Z"} {"log":"\u0009at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53)\n","stream":"stderr","time":"2018-03-22T00:00:00.636051142Z"} {"log":"\u0009at com.rabbitmq.client.impl.recovery.AutorecoveringConnection$1.shutdownCompleted(AutorecoveringConnection.java:352)\n","stream":"stderr","time":"2018-03-22T00:00:00.636233667Z"} {"log":"\u0009at com.rabbitmq.client.impl.ShutdownNotifierComponent.notifyListeners(ShutdownNotifierComponent.java:75)\n","stream":"stderr","time":"2018-03-22T00:00:00.636899252Z"} {"log":"\u0009at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:576)\n","stream":"stderr","time":"2018-03-22T00:00:00.637183801Z"}

最佳答案

根据我搜索到的内容,似乎连接可能已被 AWS 负载均衡器关闭。您能否尝试按如下方式修改您的配置:

factory.setRequestedHeartbeat(30);

看看它是否解决了您的问题?

关于amazon-ec2 - 获取 Rabbitmq HeartBeat 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49570360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com