繁体   English   中英

对等方重置 RabbitMq 连接

[英]RabbitMq connection reset by peer

我对 RabbitMQ 有污点错误。 我发送了一些关于产品抛出 RabbitMq 和 Php 的信息,但是出了点问题。 我可以在一分钟后发送消息,我有异常 "errno=104 Connection reset by peer" 。 见下文:

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}}

@Gabriele 的链接对我有帮助,以下是问题的详细信息: https ://stackoverflow.com/a/36114095/1476819

这两个更改解决了我的问题:

  • 在调用basic_consume之前添加它。 它将prefetch_count设置为1而不是“无穷大”。
$channel->basic_qos(null, 1, null);
$channel->basic_consume(...);
  • 我不确定这是否也有必要,但我已从no_ack更改为ack 这里向下滚动到消息确认标题: https ://www.rabbitmq.com/tutorials/tutorial-two-php.html

我同时完成了这些更改,现在它可以与 docker 一起使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM