问题描述
我已经在Celery设置中设置了心跳:
I have set heartbeat in Celery settings:
BROKER_HEARTBEAT = 10
我也在RabbitMQ config中设置了此配置值:
I have also set this configuration value in RabbitMQ config:
'heartbeat' => '10',
但是心跳仍然不可用:
ubuntu@sync1:~$ sudo rabbitmqctl list_connections name timeout
Listing connections ...
some_address:37781 -> other_address:5672 0
some_address:37782 -> other_address:5672 0
...done.
有什么想法我做错了吗?
Any ideas what am I doing wrong?
UPDATE:
现在我得到:
ubuntu@sync1:/etc/puppet$ sudo rabbitmqctl list_connections name timeout
Listing connections ...
some_address:41281 -> other_address:5672 10
some_address:41282 -> other_address:5672 10
some_address:41562 -> other_address:5672 0
some_address:41563 -> other_address:5672 0
some_address:41564 -> other_address:5672 0
some_address:41565 -> other_address:5672 0
some_address:41566 -> other_address:5672 0
some_address:41567 -> other_address:5672 0
some_address:41568 -> other_address:5672 0
...done.
我有3台服务器:
- RabbitMQ代理
- RESTful API服务器
- 远程工作者服务器
似乎远程被妖魔化的芹菜工人正确发送了心跳。出于某些原因,使用Celery远程处理任务的RESTful API服务器未使用心跳。
It appears the remote demonised Celery workers send heartbeats correctly. The RESTful API server using Celery to remotely process tasks is not using heartbeat for some reason.
推荐答案
芹菜工人的心跳是应用程序级别心跳,而不是AMQP协议的心跳。
每个工作人员定期向BROKER中的 celeryev事件交换发送心跳事件消息。
心跳事件被转发给工作人员,这样工作人员便可以了解代理的健康状况。
如果丢失的心跳次数超过阈值,则工作人员可以对BROKER进行一些重新连接操作。
the heartbeat of celery worker is application level heartbeat, not AMQP protocol's heartbeat. Each worker periodically send heartbeat event message to "celeryev" event exchange in BROKER.The heartbeat event is forwarded back to worker such worker can know the health status of BROKER. If number of loss heartbeat exceeding a threshold, the worker can do some reconnect action to BROKER.
有关其余详细信息,您可以检查此
本节:BROKER_FAILOVER_STRATEGY描述您可能会采取的措施,将其从经纪人处删除。
For the rest of detail, you may check this pageThe section: BROKER_FAILOVER_STRATEGY describes the actions you may do for dropping from a BROKER.
这篇关于芹菜心跳不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!