简体   繁体   English

airflow initdb 在 AIRFLOW_HOME 以外的目录中?

[英]airflow initdb in directory other than AIRFLOW_HOME?

Question for Apache Airflow / Docker users. Apache Airflow / Docker 用户的问题。 I have a Docker airflow image I've built and I'm trying to use a simple SequentialExecutor / sqlite metadata database, but I'd like to persist the metadata database every time a new container is run.我有一个 Docker airflow 图像我已经构建,我正在尝试使用一个简单的 SequentialExecutor / sqlite 元数据数据库,但我每次运行一个新的容器就像运行元数据数据库一样。 I'd like to do this by mounting to a drive on the local machine, and having it so initdb initializes the database somewhere other than AIRFLOW_HOME.我想通过安装到本地机器上的驱动器来做到这一点,并让 initdb 在 AIRFLOW_HOME 以外的地方初始化数据库。 Is this possible / configurable somehow or does anyone have a better solution?这是可能的/可配置的,还是有人有更好的解决方案?

Basically the desired state is:基本上所需的 state 是:

AIRFLOW_HOME:  contains airflow.cfg, dags, scripts, logs whatever
some_other_dir:  airflow.db

I know this is possible with logs, so why not the database?我知道这对日志是可能的,那么为什么不是数据库呢?

Thanks!谢谢!

I think the best option is to use docker-compose with a container as metadata database, like this: https://github.com/apache/airflow/issues/8605#issuecomment-623182960我认为最好的选择是将 docker-compose 与容器一起用作元数据数据库,如下所示: https://github.com/apache/airflow/issues/8605#issuecomment-623182960

I use this approach, along with git branches and it works very well.我使用这种方法以及 git 分支,并且效果很好。 The data persists unless you explicitly remove the containers with make rm除非您使用make rm显式删除容器,否则数据将持续存在

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 与Postgresql链接后,Airflow initdb命令失败 - Airflow initdb command fails after linking with postgresql airflow db init 没有在 windows 上创建预期的“airflow”目录 - airflow db init doesn't create an expected "airflow" directory on windows 如何将Airflow连接到oracle数据库 - How to Connect Airflow to oracle database initdb:错误:无法创建目录“./PostgreSQL”:权限被拒绝 - initdb: error: could not create directory “./PostgreSQL”: Permission denied 为什么我们需要 airflow 挂钩? - Why do we need airflow hooks? Airflow - 跨任务的数据库连接重用 - Airflow - Database connection reuse across tasks 初始化 airflow.2.3.3 时出错“表‘airflow.ab_permission_id_seq’不存在” - Error in initializing airflow.2.3.3 "Table 'airflow.ab_permission_id_seq' doesn't exist" 如何在Airflow Scheduler中解决DB连接无效警告? - How to resolve DB connection invalidated warning in Airflow Scheduler? 您是否将数据存储在与 Airflow 后端相同的数据库中? - Do you store data in the same database as Airflow's backend? 使用 appache airflow 建立数据库连接后如何获取表名 - How to get the Table Name after establishment a database connection using appache airflow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM