安装Mysql (否则后面 pip install mysql) 无法安装
#ubuntu sudo apt-get install libmysqlclient-dev
pip 依赖:
pip install apache-airflow[celery,crypto,mysql,password,redis]
airflow-LocalExecutor
pip install mysqlclient
create database airflow; —— 创建数据库
GRANT all privileges on airflow.* TO 'airflow'@'%' IDENTIFIED BY '123456'; —— 将数据库airflow的所有权限授权airflow用户,密码123456且该用户可在任何IP段登录操作
FLUSH PRIVILEGES; —— 刷新权限
set explicit_defaults_for_timestamp = 1;
sql_alchemy_conn = mysql://airflow:123456@mysqlIP/airflow
修改执行器,使airflow并发调度任务
executor = LocalExecutor
重启scheduler即可(默认并发调度16)
airflow initdb
若之前使用sqllite初始化过可使用airflow resetdb
docker exec -it meu_mysql /bin/bash cd /etc/mysql/ root@8ab0b9bd6a08:/etc/mysql/conf.d# cat mysql.cnf [mysql] root@8ab0b9bd6a08:/etc/mysql/conf.d# echo '[mysqld]' >> mysql.cnf root@8ab0b9bd6a08:/etc/mysql/conf.d# echo 'explicit_defaults_for_timestamp = 1' >> mysql.cnf root@8ab0b9bd6a08:/etc/mysql/conf.d# cat mysql.cnf [mysql] [mysqld] explicit_defaults_for_timestamp = 1max_allowed_packet= 500M
max_allowed_packet= 500M
1.需要使用同步方式解决dags目录与worker的同步问题——待解决
2.需要解决scheduler的单点问题,可参考 apache-airflow 调度系统 https://blog.csdn.net/somezz/article/details/82749495
cankao :https://my.oschina.net/u/3770892/blog/3069220