简体   繁体   English

AWS MWAA:尝试在 Docker 上运行本地 Apache Airflow 环境时出现“无法访问 Postgres”错误

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

Following the AWS MWAA (Amazon Managed Workflows for Apache Airflow) installation tutorial for Windows using Docker in WSL (Windows Subsystem for Linux) 2 with Ubuntu distro, I encountered a problem when trying to run a local Apache Airflow environment.按照适用于 Windows 的AWS MWAA(Amazon Managed Workflows for Apache Airflow)安装教程使用 WSL(Linux 的 Windows 子系统)2 中的 Docker 和 Ubuntu 发行版,我在尝试运行本地 Apache Airflow 环境时遇到了问题。

When I input the command wsl ./mwaa-local-env start , this is the output:当我输入命令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

This solution fixed it for me:该解决方案为我修复了它:

  1. docker volume create --name=db-data to create a db-data volume in docker docker volume create --name=db-data在 docker 中创建一个db-data

  2. In file ./docker/docker-compose-local.yml change the line在文件./docker/docker-compose-local.yml更改行

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

    to

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

Credits to : https://github.com/aws/aws-mwaa-local-runner/issues/45归功于: https ://github.com/aws/aws-mwaa-local-runner/issues/45

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM