database
system_error
ai_generated
true
错误:归档命令失败,退出代码为1 详细信息:归档命令是:cp %p /archive/%f
ERROR: archive command failed with exit code 1 DETAIL: The archive command was: cp %p /archive/%f
ID: database/postgres-wal-archive-failure
85%修复率
85%置信度
1证据数
2023-06-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| PostgreSQL 14 | active | — | — | — |
| PostgreSQL 15 | active | — | — | — |
| PostgreSQL 16 | active | — | — | — |
根因分析
PostgreSQL WAL归档命令因磁盘空间不足、权限问题或归档目标路径不正确而失败。
English
PostgreSQL WAL archiving command fails due to insufficient disk space, permission issues, or incorrect archive destination path.
官方文档
https://www.postgresql.org/docs/16/continuous-archiving.html解决方案
-
Check disk space on archive destination: df -h /archive; if full, free space or increase archive destination mount size.
-
Fix permissions on archive directory: chown -R postgres:postgres /archive; chmod 700 /archive;
-
Test the archive command manually: sudo -u postgres cp /var/lib/postgresql/16/main/pg_wal/000000010000000000000001 /archive/; then fix any errors.
无效尝试
常见但无效的做法:
-
Increase wal_keep_segments to a very high value to avoid archiving
60% 失败
This only delays the problem; WAL segments still accumulate and eventually fill pg_wal, causing PostgreSQL to crash.
-
Set archive_mode=off to disable archiving entirely
90% 失败
Disabling archiving breaks point-in-time recovery and replication; not a viable fix for production systems that require backups.