为什么 Airflow 声称 SQLite 是默认后端,而它似乎是 Postgres?
Why does Airflow claim SQLite is the default backend when it seems to be Postgres?
我运行通过 provided official image. Now, the documentation 在 Docker 上安装 Airflow 2.2.1 说:
Airflow comes with an SQLite backend by default. This allows the user to run Airflow without any external database. However, such a setup is meant to be used for testing purposes only; running the default setup in production can lead to data loss in multiple scenarios. If you want to run production-grade Airflow, make sure you configure the backend to be an external database such as PostgreSQL or MySQL.
然而,docker-compose.yaml given in the documentation (see Running Airflow in Docker) 没有提及 SQLite。事实上,它定义了(除其他外):
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
所以现在我很困惑。为什么文档声称 SQLite 是默认后端?默认后端不是 Postgres 数据库吗?不管怎样,我应该乐于使用此处提供的 Postgres 数据库进行生产,还是应该按照文档的建议(参见 here)设置自己的自定义数据库作为后端?事实上,我什至不太明白默认后端是一个 Postgres 数据库 - 这也是 运行 在一个单独的容器中吗?
Airflow(没有 docker-compose 文件或 Helm Chart)默认使用 SQLite。
但是,官方 docker-compose 创建了一个 Postgres 容器并使用它,以便您可以 运行 并行执行任务。
同样,official Helm Chart 还创建了一个 Postgres 服务用于快速测试。
但是,对于生产用例,您不应在容器内使用数据库 运行ning,因为容器最常用于临时 storage/tasks。因此,对于生产环境,您应该使用托管数据库,例如 Cloud SQL(在 GCP 上)。详情:https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#database
我运行通过 provided official image. Now, the documentation 在 Docker 上安装 Airflow 2.2.1 说:
Airflow comes with an SQLite backend by default. This allows the user to run Airflow without any external database. However, such a setup is meant to be used for testing purposes only; running the default setup in production can lead to data loss in multiple scenarios. If you want to run production-grade Airflow, make sure you configure the backend to be an external database such as PostgreSQL or MySQL.
然而,docker-compose.yaml given in the documentation (see Running Airflow in Docker) 没有提及 SQLite。事实上,它定义了(除其他外):
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
所以现在我很困惑。为什么文档声称 SQLite 是默认后端?默认后端不是 Postgres 数据库吗?不管怎样,我应该乐于使用此处提供的 Postgres 数据库进行生产,还是应该按照文档的建议(参见 here)设置自己的自定义数据库作为后端?事实上,我什至不太明白默认后端是一个 Postgres 数据库 - 这也是 运行 在一个单独的容器中吗?
Airflow(没有 docker-compose 文件或 Helm Chart)默认使用 SQLite。
但是,官方 docker-compose 创建了一个 Postgres 容器并使用它,以便您可以 运行 并行执行任务。
同样,official Helm Chart 还创建了一个 Postgres 服务用于快速测试。
但是,对于生产用例,您不应在容器内使用数据库 运行ning,因为容器最常用于临时 storage/tasks。因此,对于生产环境,您应该使用托管数据库,例如 Cloud SQL(在 GCP 上)。详情:https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#database