yum install redhat-rpm-config -yyum install mysql-devel -yyum install python3-devel -ydnf update gcc annobin -y
Home directory.mkdir -p /usr/local/services/airflowexport AIRFLOW_HOME=/usr/local/services/airflow
AIRFLOW_HOME variable can be configured in the /etc/profile file.pip install apache-airflow[mysql]
airflow initdb
airflow webserver -D
url http://{ip}:8080/admin/, the configuration is successful.airflow.cfg in AIRFLOW_HOME.Change `default_timezone = utc` to `default_timezone = Asia/Shanghai`Change `default_ui_timezone = UTC` to `default_ui_timezone = Asia/Shanghai`
/usr/local/lib/python3.6/site-packages/airflow/utils/timezone.py file.
Add the following statement below the utc = pendulum.timezone('UTC') statement:from airflow.configuration import conftry:tz = conf.get("core", "default_timezone")if tz == "system":utc = pendulum.local_timezone()else:utc = pendulum.timezone(tz)except Exception:pass
utcnow() function:Change `d = dt.datetime.utcnow()` to `d = dt.datetime.now()`
/usr/local/lib/python3.6/site-packages/airflow/utils/sqlalchemy.py file.
Add the following content below the utc = pendulum.timezone('UTC') statement:from airflow.configuration import conftry:tz = conf.get("core", "default_timezone")if tz == "system":utc = pendulum.local_timezone()else:utc = pendulum.timezone(tz)except Exception:pass
cursor.execute("SET time_zone = '+00:00'")
/usr/local/lib/python3.6/site-packages/airflow/www/templates/admin/master.html file.var UTCseconds = (x.getTime() + x.getTimezoneOffset()*60*1000);Change tovar UTCseconds = x.getTime();
"timeFormat":"H:i:s %UTC%",Change to"timeFormat":"H:i:s",
cat {AIRFLOW_HOME}/airflow-webserver.pidkill {pid}airflow webserver -D
explicit_defaults_for_timestamp parameter and cannot be used for Airflow storage.explicit_defaults_for_timestamp parameter to ON in the console.create database airflow;create user 'airflowuser'@'%' identified by 'pwd123';grant all on airflow.* to 'airflowuser'@'%';flush privileges;
{AIRFLOW_HOME}/airflow.cfg.sql_alchemy_conn = sqlite:////usr/local/services/airflow/airflow.dbChange tosql_alchemy_conn = mysql://airflowuser:pwd123@{ip}/airflow
airflow initdb
airflow resetdb
Feedback