芹菜心跳不工作

Celery Heartbeat Not Working(芹菜心跳不工作)
本文介绍了芹菜心跳不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在 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',

但不知何故心跳仍然被禁用:

But somehow heartbeats are still disabled:

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?

更新:

所以现在我明白了:

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 工人正确地发送了心跳.使用 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.

推荐答案

celery worker的心跳是应用层的心跳,不是AMQP协议的心跳.每个工作人员定期向 BROKER 中的celeryev"事件交换发送心跳事件消息.心跳事件被转发回worker,这样worker就可以知道BROKER的健康状态.如果丢失心跳的次数超过阈值,worker 可以对 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 部分描述了从 BROKER 中删除可以执行的操作.

For the rest of detail, you may check this page The section: BROKER_FAILOVER_STRATEGY describes the actions you may do for dropping from a BROKER.

这篇关于芹菜心跳不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Seasonal Decomposition of Time Series by Loess with Python(Loess 用 Python 对时间序列进行季节性分解)
Resample a time series with the index of another time series(使用另一个时间序列的索引重新采样一个时间序列)
How can I simply calculate the rolling/moving variance of a time series in python?(如何在 python 中简单地计算时间序列的滚动/移动方差?)
How to use Dynamic Time warping with kNN in python(如何在python中使用动态时间扭曲和kNN)
Keras LSTM: a time-series multi-step multi-features forecasting - poor results(Keras LSTM:时间序列多步多特征预测 - 结果不佳)
Python pandas time series interpolation and regularization(Python pandas 时间序列插值和正则化)