我正在尝试使用docker官方图片在Postgres 13.1中设置WAL归档。我正在docker compose文件的命令行上设置archive_命令设置,但该命令在日志中显示“not found”。当我直接在容器上运行命令时,一切都很好。
有没有办法更好地记录失败的原因?
Docker编写文件:
version: "3.8"
services:
test_server_database:
build:
context: .
dockerfile: Dockerfile-test-database
volumes:
- test-db:/var/lib/postgresql/data
- test-db-creds:/root/.ssh
environment:
POSTGRES_USER: test
POSTGRES_PASSWORD:
POSTGRES_DB: test_db
ports:
- 5433:5432
command:
- "postgres"
- "-c"
- "wal_level=logical"
- "-c"
- "archive_mode=on"
- "-c"
- 'archive_command="/usr/bin/scp -v -i /root/.ssh/ingest_id_rsa -pr -P 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /var/lib/postgresql/data/%p linuxserver.io@ingest_1:/data/wal/%f"'
- "-c"
- 'log_min_messages=DEBUG1'
volumes:
test-db:
test-db-creds:
日志消息:
test_server_database_1 | sh: 1: /usr/bin/scp -v -i /root/.ssh/ingest_id_rsa -pr -P 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /var/lib/postgresql/data/pg_wal/00000001000000000000001F linuxserver.io@ingest_1:/data/wal/00000001000000000000001F: not found
test_server_database_1 | 2021-05-07 22:02:10.196 UTC [32] FATAL: archive command failed with exit code 127
test_server_database_1 | 2021-05-07 22:02:10.196 UTC [32] DETAIL: The failed archive command was: "/usr/bin/scp -v -i /root/.ssh/ingest_id_rsa -pr -P 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /var/lib/postgresql/data/pg_wal/00000001000000000000001F linuxserver.io@ingest_1:/data/wal/00000001000000000000001F"
test_server_database_1 | 2021-05-07 22:02:10.199 UTC [1] LOG: archiver process (PID 32) exited with exit code 1