![](/img/trans.png)
[英]PostgreSQL / WAL-archiving: can I leave archive_command empty when doing image snapshot backups?
[英]Setting up WAL archiving by passing archive_command on the postgres command line in docker compose
我正在嘗試使用官方 docker 圖像在 Postgres 13.1 中設置 WAL 歸檔。 我在 docker 撰寫文件的命令行上設置 archive_command 設置,但命令在日志中顯示“未找到”。 當我直接在容器上運行命令時,一切都很好。
有沒有辦法更好地記錄失敗的原因?
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
我的錯誤是在 archive_command 設置中的命令周圍包含雙引號,它應該不帶引號:
- "-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'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.