一 官方

airflow官方分布式部署结构图

airflow进程

  • webserver
  • scheduler
  • flower(非必须)
  • worker

airflow缺点

  • scheduler单点
  • 通过在scheduler的dags目录变动dag文件来提交流程

官方分布式部署方案

  • 多个webserver
  • 多个worker
    • CeleryExecutor(依赖redis或rabbitmq)
    • MesosExecutor(依赖mesos)

第三方开源方案ASFC

针对scheduler单点问题,有第三方方案:https://github.com/teamclairvoyant/airflow-scheduler-failover-controller

The Airflow Scheduler Failover Controller (ASFC) is a mechanism that ensures that only one Scheduler instance is running in an Airflow Cluster at a time. This way you don't come across the issues we described in the "Motivation" section above.

You will first need to startup the ASFC on each of the instances you want the scheduler to be running on. When you start up multiple instances of the ASFC one of them takes on the Active state and the other takes on a Standby state. There is a heart beat mechanism setup to track if the Active ASFC is still active. If the Active ASFC misses multiple heart beats, the Standby ASFC becomes active.

The Active ASFC will poll every 10 seconds to see if the scheduler is running on the desired node. If it is not, the ASFC will try to restart the daemon. If the scheduler daemons still doesn't startup, the daemon is started on another node in the cluster.

Airflow Scheduler Failover Controller (ASFC),实现方式为:多个实例中只有一个处于active状态,处于active状态的实例会每10s检查一下scheduler进程是否存活并根据需要重启进程;

坏消息是该方案和airflow新版本1.10不兼容

二 基于mesos+hdfs的airflow生产环境部署方案研究

相同部分

和官方一致

  • 使用mysql数据库作为元数据库

和官方不一致1

  • 所有对dags目录的修改同步到hdfs上,保证dags目录的高可用
  • 使用HDFS NFSGateway,将hdfs挂载到所有可能的scheduler节点上的,无论scheduler被部署在哪个节点上,都使用同一个dags目录
  • 使用nginx+marathon-lb向外暴露airflow的webserver,可以操作流程或查看流程执行情况等

1 airflow单实例容器部署方案

和官方不一致2

  • webserver、scheduler、worker作为docker容器运行,在多个节点上只部署一个实例,由marathon保证可用性,由marathon-lb做服务发现
  • worker使用LocalExecutor,即所有的任务都使用子进程执行
    • 为了使容器内的worker的LocalExecutor能够访问外部集群功能,一种可行的方式是将各种组件的父目录挂载到容器中(比如各个组件目录为/app/java、/app/hive、/app/spark、/app/hdfs,则挂载/app目录到容器内),然后所有的任务脚本一开始统一引入执行一个初始化环境变量的公共脚本,设置各种Home和Path,然后就可以在容器内使用各种组件的客户端,比如java、hive、spark、hdfs等

2 airflow分布式容器部署方案

和官方不一致2

  • webserver和scheduler作为docker容器运行,在多个节点上只部署一个实例,由marathon保证可用性,由marathon-lb做服务发现
  • worker使用MesosExecutor:
    • 直接在mesos agent上执行airflow任务,好处是可以保证具体任务能够访问到集群的功能,比如impala/flink,缺点是需要在所有mesos agent节点的宿主机上部署airflow
    • 在mesos agent上部署airflow worker的docker容器,然后在容器中执行airflow任务,好处是部署0成本,缺点是docker容器内只包含worker,不能使用外部集群的功能,不过这个缺点可以使用上一方案中LocalExecutor相同的方式解决

airflow docker image:https://github.com/puckel/docker-airflow

最新文章

  1. 初识Python-Python介绍
  2. linux test 命令使用
  3. fastcgi是什么?与php-fpm之间是什么关系?
  4. selenium配置
  5. 关于javascript中的===和==
  6. 基于案例贯通 Spark Streaming 流计算框架的运行源码
  7. Python入门笔记(13):列表解析
  8. 在android.app.Application中定义全局变量
  9. [book]awesome-machine-learning books
  10. 前端开发bower包管理器
  11. jQuery load()和ready()
  12. 如何更改IE查看源代码菜单使用的HTML编辑器
  13. Tweak 中系统方法写入文件到根目录下面失败
  14. redhat6 + 11G RAC 双节点部署
  15. jenkins-Couldn't find any revision to build. Verify the repository and branch configuration for this job
  16. vue.js之动画篇
  17. jenkins多个slave遇到的坑
  18. XAF 与 CIIP
  19. FIDDLER的使用方法及技巧总结(连载五)FIDDLER的一些故障排除
  20. OpenDayLight Helium实验三 OpenDaylight二层转发机制实验 2

热门文章

  1. vue input添加回车触发
  2. Kettle系列:使用Kudu API插入数据到Kudu中
  3. vue插件 使用use注册Vue全局组件和全局指令
  4. windows生成dump文件
  5. Windows Docker Toolbox 安装Redis等开发环境
  6. sql -leetcode 178. Rank Scores
  7. PHP面向对象的三大特征操作——封装、继承、多态(下)
  8. 采用shell脚本定时清理Tomcat日志
  9. Liunx/RHEL6.5 Oracle11 安装记录
  10. 闭包可以存储变量(下标) 小demo