美文网首页
Airflow 安装

Airflow 安装

作者: noteby | 来源:发表于2020-07-16 09:52 被阅读0次

    平台:ubuntu

    apt-get install libmysqlclient-dev
    apt-get install python3-mysqldb

    安装airflow

    python3 -m pip install 'apache-airflow'
    python3 -m pip install 'apache-airflow[mysql]'
    python3 -m pip install 'apache-airflow[celery]'

    安装mysql

    sudo apt-get install mysql-server
    sudo chown -R mysql:mysql /var/lib/mysql

    启动服务

    sudo service mysql start
    sudo service mysql status

    设置密码(root@123)

    mysql_secure_installation

    建库

    CREATE DATABASE airflow DEFAULT CHARACTER SET utf8;

    建用户

    create user 'airflow'@'%' identified by 'airflow@123';

    用户授权

    grant all on airflow.* to 'airflow'@'%';

    刷新权限

    flush privileges;

    修改mysql配置

    /etc/mysql/mysql.conf.d => [mysqld] explicit_defaults_for_timestamp=true
    sudo service mysqld restart
    show global variables like '%timestamp%';

    修改airflow.cfg文件相关参数

    sql_alchemy_conn = mysql+mysqldb://airflow:airflow@123@localhost:3306/airflow
    default_timezone = Asia/Shanghai
    executor = CeleryExecutor

    airflow初始化

    airflow initdb

    报错处理

    1.mysql_config not found
    先查看下是否已经存在mysql_config文件,find / -name mysql_config
    如果没有的话,安装mysql-devel:
    apt-get install libmysqld-dev ([centos] yum install mysql-devel)

    其他

    1.python 查看安装包路径
    pip show 包名

    相关文章

      网友评论

          本文标题:Airflow 安装

          本文链接:https://www.haomeiwen.com/subject/sonuhktx.html