簡體   English   中英

AWS MWAA:嘗試在 Docker 上運行本地 Apache Airflow 環境時出現“無法訪問 Postgres”錯誤

[英]AWS MWAA: 'Postgres not reachable' error when trying to run a local Apache Airflow environment on Docker

按照適用於 Windows 的AWS MWAA(Amazon Managed Workflows for Apache Airflow)安裝教程使用 WSL(Linux 的 Windows 子系統)2 中的 Docker 和 Ubuntu 發行版,我在嘗試運行本地 Apache Airflow 環境時遇到了問題。

當我輸入命令wsl ./mwaa-local-env start ,輸出如下:

docker-postgres-1      | chmod: /var/lib/postgresql/data: Operation not permitted
docker-postgres-1      | The files belonging to this database system will be owned by user "postgres".
docker-postgres-1      | This user must also own the server process.
docker-postgres-1      |
docker-postgres-1      | The database cluster will be initialized with locale "en_US.utf8".
docker-postgres-1      | The default database encoding has accordingly been set to "UTF8".
docker-postgres-1      | The default text search configuration will be set to "english".
docker-postgres-1      |
docker-postgres-1      | Data page checksums are disabled.
docker-postgres-1      |
docker-postgres-1      | fixing permissions on existing directory /var/lib/postgresql/data ... initdb: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
docker-postgres-1 exited with code 1
docker-local-runner-1  | Sat Feb 12 21:14:01 UTC 2022 - waiting for Postgres... 1/20
docker-local-runner-1  | Sat Feb 12 21:14:26 UTC 2022 - waiting for Postgres... 2/20
docker-local-runner-1  | Sat Feb 12 21:14:51 UTC 2022 - waiting for Postgres... 3/20
docker-local-runner-1  | Sat Feb 12 21:15:16 UTC 2022 - waiting for Postgres... 4/20
docker-local-runner-1  | Sat Feb 12 21:15:41 UTC 2022 - waiting for Postgres... 5/20
docker-local-runner-1  | Sat Feb 12 21:16:06 UTC 2022 - waiting for Postgres... 6/20
docker-local-runner-1  | Sat Feb 12 21:16:32 UTC 2022 - waiting for Postgres... 7/20
docker-local-runner-1  | Sat Feb 12 21:16:57 UTC 2022 - waiting for Postgres... 8/20
docker-local-runner-1  | Sat Feb 12 21:17:22 UTC 2022 - waiting for Postgres... 9/20
docker-local-runner-1  | Sat Feb 12 21:17:47 UTC 2022 - waiting for Postgres... 10/20
docker-local-runner-1  | Sat Feb 12 21:18:12 UTC 2022 - waiting for Postgres... 11/20
docker-local-runner-1  | Sat Feb 12 21:18:37 UTC 2022 - waiting for Postgres... 12/20
docker-local-runner-1  | Sat Feb 12 21:19:03 UTC 2022 - waiting for Postgres... 13/20
docker-local-runner-1  | Sat Feb 12 21:19:28 UTC 2022 - waiting for Postgres... 14/20
docker-local-runner-1  | Sat Feb 12 21:19:53 UTC 2022 - waiting for Postgres... 15/20
docker-local-runner-1  | Sat Feb 12 21:20:19 UTC 2022 - waiting for Postgres... 16/20
docker-local-runner-1  | Sat Feb 12 21:20:44 UTC 2022 - waiting for Postgres... 17/20
docker-local-runner-1  | Sat Feb 12 21:21:09 UTC 2022 - waiting for Postgres... 18/20
docker-local-runner-1  | Sat Feb 12 21:21:34 UTC 2022 - waiting for Postgres... 19/20
docker-local-runner-1  | Sat Feb 12 21:21:59 UTC 2022 - postgres:5432 still not reachable, giving up
docker-local-runner-1 exited with code 1

該解決方案為我修復了它:

  1. docker volume create --name=db-data在 docker 中創建一個db-data

  2. 在文件./docker/docker-compose-local.yml更改行

    - "${PWD}/db-data:/var/lib/postgresql/data"

    - "/db-data:/var/lib/postgresql/data"

歸功於: https ://github.com/aws/aws-mwaa-local-runner/issues/45

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM