编辑(2020-4-18):添加了元数据数据库的上下文。添加了关于StatsD的上下文。
背景
我操作气流1.10.3部署。它使用MySQL 5.7作为元数据数据库。它使用CeleryExecutor和Redis 3.2.5作为芹菜经纪人。
我构建了气流包,我的DAG代码,和任何其他相关的信任到1码头形象。
我的部署启动了每个Webserver、for服务器、Scheduler和Worker的Docker容器;它们都是从1 Docker映像中派生出来的。Redis也在码头容器中运行,但不是从与其他气流组件相同的码头映像中运行的。MySQL不是容器化的,而是像任何传统的OLTP数据库一样保持和运行。部署顺序包括:
是唯一在部署过程中没有被“擦除和替换”的气流组件是Redis容器.。
我(连续)每天部署3-7次。
问题
通常,在正常运行期间,一组气流任务在日志中显示如下:
[2018-02-23 12:57:01,711] {models.py:1190} INFO - Dependencies not met for <TaskInstance: userdbs.dump.dedicated 2018-02-21 02:00:00 [running]>, dependency 'Task Instance State' FAILED: Task is in the 'running' state which is not a valid state for execution. The task must be cleared in order to be run.
[2018-02-23 12:57:01,711] {models.py:1190} INFO - Dependencies not met for <TaskInstance: userdbs.dump.clustered 2018-02-21 02:00:00 [running]>, dependency 'Task Instance Not Already Running' FAILED: Task is already running, it started on 2018-02-23 06:54:44.431988.这些任务通常运行时间很长.当我调查的时候,基本的任务通常是合法地运行的。我的DAG任务可以处理大量的数据,并且合法地需要运行6到10个小时才能成功完成。因此,关于分解这些任务以处理更少数据的讨论应该超出这个问题的范围。
--我相信这与我如何部署以及上面的日志通常何时出现有关。,但我没有硬性数据来支持这一点。
一些在线搜索显示,将芹菜可见性超时提高到比我预期的最长运行任务(跨所有DAG)高的值应该可以解决这个问题。--我计划实现这个.
但我最关心的是,增加了可见性超时时间(可能达到11小时)+没有在部署时杀死Redis容器,这会给我留下大约11个小时的时间来注意到它需要重新安排任务。这种担忧源于芹菜文档(https://docs.celeryproject.org/en/latest/getting-started/brokers/redis.html#id1)中的这一评论:
Note that Celery will redeliver messages at worker shutdown, so having a long visibility timeout will only delay the redelivery of ‘lost’ tasks in the event of a power failure or forcefully terminated workers.问题
发布于 2020-04-18 15:10:05
不能回答你所有的问题,但是:
我认为你不应该碰你的Redis容器(换句话说-保持它)。我认为您应该将其配置为您的芹菜后端结果。此外,考虑以下配置(我正在使用它):
考虑到指标,对于芹菜,您可以使用Flower (不要重新启动这个容器!)我看到了一个为气流配置Statsd的选项(我没有尝试过)。查看airflow.cfg中的下列配置
# Statsd (https://github.com/etsy/statsd) integration settings
statsd_on = False
statsd_host = localhost
statsd_port = 8125
statsd_prefix = airflowhttps://stackoverflow.com/questions/61290901
复制相似问题