- Create an
airflow
folder and then get into it - Create a Python3 virtual environment in it
- Run the installation command in PyPI way and ensure the Python version is the same. For example,
pip install 'apache-airflow==2.9.1' --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.9.1/constraints-3.12.txt"
- Set up
export AIRFLOW_HOME=/home/ubuntu/airflow
- Initialisation
airflow db init
- Run Web server
airflow webserver -p 8080
- Set up user
airflow users create --username admin --firstname Aemon --lastname Wang --role Admin --email aemooooon@gmail.com
When first time access the link might face some error, tryairflow db init
again orairflow db migrate
- Run scheduler service
airflow scheduler
设置默认数据库为PSQL
准备好数据库,然后修改文件,把默认的sqlite换成你的psql数据库就行了。
airflow.cfg
sql_alchemy_conn = postgresql+psycopg2://airflowuser:yourpassword@airflow-db.xxxxxxxx.us-west-2.rds.amazonaws.com:5432/yourdbname
executor = SequentialExecutor
executor = SequentialExecutor
load_examples = False
设置开发数据库为PSQL
直接在airflow web 管理中心的connections管理里面添加连接字符串即可。
lsof -i :8793