无法让 Airflow 使用 postgresql ( rds ) 代替 sqlite

问题描述 投票:0回答:1

我在 3 个 ec2 节点上安装了气流:网络服务器、调度程序和工作线程,我在所有 3 个节点上将相同的配置设置为

/airflow/airflow.cfg
,接下来是数据库配置
sql_alchemy_conn = postgresql+psycopg2://airflow:[email protected]/airflow
。 之后我重新启动服务
airflow
并执行命令
airflow initdb

ec2-user@ip-10-0-0-143 airflow]$ /usr/local/bin/airflow initdb
DB: sqlite:////airflow/airflow.db
[2019-11-21 01:39:30,325] {db.py:368} INFO - Creating tables
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
WARNI [airflow.utils.log.logging_mixin.LoggingMixin] empty cryptography key - values will not be stored encrypted.
Done.

但是气流仍在使用

sqlite
DB: sqlite:////airflow/airflow.db

postgresql airflow
1个回答
0
投票

是的,我找到了解决方案:设置

sql_alchemy_conn = postgresql+psycopg2://airflow:██████████@rdsdatabaseaddreess.com/airflow
必须位于
[core]
部分。 官方文档中提到了这一点。但是,它位于示例配置中的
[database]
部分。

所以,最后,我的设置如下所示:

[core]
executed = LocalExecutor
sql_alchemy_conn = postgresql+psycopg2://airflow:████████@rdsdatabaseaddreess.com/airflow


[database]
sql_alchemy_conn = postgresql+psycopg2://airflow:████████@rdsdatabaseaddreess.com/airflow
© www.soinside.com 2019 - 2024. All rights reserved.