RabbitMq连接被对等方重置

0g0grzrc  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(1)|浏览(318)

我有stainger错误与RabbitMQ。我发送一些信息的产品抛出RabbitMq和Php,但出了问题。我可以发送消息后,我有异常“errno=104连接重置由对等”近一分钟。见下:

2016-05-09 08:13:14 Daemon start
2016-05-09 08:13:17 Send to shop-id-1-price
2016-05-09 08:13:21 Send to shop-id-1-price
2016-05-09 08:13:24 Send to shop-id-1-price
2016-05-09 08:13:28 Send to shop-id-1-price
2016-05-09 08:13:32 Send to shop-id-1-price
2016-05-09 08:13:36 Send to shop-id-1-price
2016-05-09 08:13:39 Send to shop-id-1-price
2016-05-09 08:13:43 Send to shop-id-1-price
2016-05-09 08:13:47 Send to shop-id-1-price

  [ErrorException]                                                           
  fwrite(): send of 21 bytes failed with errno=104 Connection reset by peer  

rabbitmq:consumer [-m|--messages [MESSAGES]] [-r|--route [ROUTE]] [-l|--memory-limi
t [MEMORY-LIMIT]] [-d|--debug] [--] <name>

PHP Fatal error:  Uncaught ErrorException: fwrite(): send of 19 bytes failed with e
rrno=32 Broken pipe in /chroot/data/stage/home/html/vendor/videlalva
ro/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php:271

RabbitMQ的版本-3.6.1、PHP的版本-7.0.5、PHP-amqp库的版本-“videlalvaro/PHP-amqplib”:“~2.7
来自rabbitmq的日志:

=INFO REPORT==== 9-May-2016::03:36:53 ===
accepting AMQP connection <0.25777.24> (104.207.249.104:38001 -> 104.207.249.104:5672)

=ERROR REPORT==== 9-May-2016::03:37:23 ===
closing AMQP connection <0.25777.24> (104.207.249.104:38001 -> 104.207.249.104:5672):
{writer,send_failed,{error,timeout}}
vktxenjb

vktxenjb1#

@加布里埃莱的链接对我有帮助,以下是问题可能的细节:https://stackoverflow.com/a/36114095/1476819
这两个变化解决了我的问题:

  • 在调用basic_consume之前添加这个。它将prefetch_count设置为1而不是“infinity”。
$channel->basic_qos(null, 1, null);
$channel->basic_consume(...);

我已经同时做了这些改变,现在它与docker一起工作。

相关问题