2013-08-30 87 views
1

设置:Centos的6.2,RabbitMQ的3.1.3,5.4.3 PHP的RabbitMQ和PHP-amqplib - 消息没有被交付给消费者

我试图从php-amqlib运行演示脚本,特别是 amqp_consumer_non_blocking.php & amqp_publisher.php

在一个控制台我跑的PHP amqp_consumer_non_blocking.php“,在另一个 'PHP amqp_publisher.php这是一个测试'

'amqp_consumer_non_blocking.php' 坐在了等待:

< 60,20: Basic.consume 
waiting for 60,21 
waiting for a new frame 
> 60,21: Basic.consume_ok 

和 'amqp_publisher.php' 产生这样的:消息似乎

< 60,40: Basic.publish 
< [hex]: 
0000 02 00 01 00 00 00 1A 00 3C 00 00 00 00 00 00 00 ........ <....... 
0010 00 00 0E 90 00 0A 74 65 78 74 2F 70 6C 61 69 6E .....te xt/plain 
0020 02 CE            .Î 

< [hex]: 
0000 03 00 01 00 00 00 0E 54 68 69 73 20 69 73 20 61 .......T his is a 
0010 20 74 65 73 74 CE         testÎ 

< [hex]: 
0000 01 00 01 00 00 00 0B 00 14 00 28 00 00 00 00 00 ........ ..(..... 
0010 00 00 CE           ..Î 

< 20,40: Channel.close 
waiting for 20,41 
waiting for a new frame 

没有得到传递。

不过,我已经运行另一个虚拟机上运行这些脚本版本(CentOS 6.2,兔3.1.3,5.4.3 PHP)和 'amqp_publisher.php' 得到如下:

< 60,40: Basic.publish 
< [hex]: 
0000 02 00 01 00 00 00 1A 00 3C 00 00 00 00 00 00 00 ........ <....... 
0010 00 00 0E 90 00 0A 74 65 78 74 2F 70 6C 61 69 6E .....te xt/plain 
0020 02 CE            .Î 

< [hex]: 
0000 03 00 01 00 00 00 0E 54 68 69 73 20 69 73 20 61 .......T his is a 
0010 20 74 65 73 74 CE         testÎ 

< [hex]: 
0000 01 00 01 00 00 00 0B 00 14 00 28 00 00 00 00 00 ........ ..(..... 
0010 00 00 CE           ..Î 

< 20,40: Channel.close 
waiting for 20,41 
waiting for a new frame 
> 20,41: Channel.close_ok 
< [hex]: 
0000 01 00 00 00 00 00 0B 00 0A 00 32 00 00 00 00 00 ........ ..2..... 
0010 00 00 CE           ..Î 

< 10,50: Connection.close 
waiting for 10,51 
waiting for a new frame 
> 10,51: Connection.close_ok 
closing socket 

这从消费者脚本:

< 60,20: Basic.consume 
waiting for 60,21 
waiting for a new frame 
> 60,21: Basic.consume_ok 
waiting for any method 
waiting for a new frame 
> 60,60: Basic.deliver 
waiting for a new frame 
waiting for a new frame 

-------- 
This is a test 
-------- 
< [hex]: 
0000 01 00 01 00 00 00 0D 00 3C 00 50 00 00 00 00 00 ........ <.P..... 
0010 00 00 01 00 CE          ....Î 

< 60,80: Basic.ack 

在成功的示例中,我可以看到返回的delivery_mode为2。信息没有被传送的原因是什么?

回答

3

Matthias Radestock通过暗示它看起来像资源问题,指出我正确的方向,并建议我检查服务器日志。我发现在/var/log/rabbitmq/rabbit\@localhost.log如下:

=INFO REPORT==== 02-Sep-2013::12:48:48 === 
Disk free limit set to 1000MB 

=INFO REPORT==== 02-Sep-2013::12:48:48 === 
Disk free space insufficient. Free bytes:588042240 Limit:1000000000 

=WARNING REPORT==== 02-Sep-2013::12:48:48 === 
disk resource limit alarm set on node '[email protected]'. 

********************************************************** 
*** Publishers will be blocked until this alarm clears *** 
********************************************************** 

创建的文件/etc/rabbitmq/rabbitmq.config并添加以下内容:

[{rabbit, [{disk_free_limit, 100000000}]}]. 

重新启动的RabbitMQ &现在我可以按预期发布&消耗。