悠扬随风 发表于 2023-10-8 00:38:28

运行在容器中Postgres数据库数据损坏后如何恢复?

前言

在使用 K8S 部署 RSS 全套自托管解决方案- RssHub + Tiny Tiny Rss, 我介绍了将 RssHub + Tiny Tiny RSS 部署到 K8s 集群中的方案. 其中 TTRSS 会用到 Postgres 存储数据, 也一并部署到 K8s 容器中.
但是最近, 由于一次错误操作, 导致 Postgres 数据库的 WAL 损坏, Postgres 的 Pod 频繁 CrashBackoffLoop. 具体报错如下:
Postgres shutdown exit code 1:
2023-09-27 02:32:17.127 UTC LOG:received fast shutdown request
2023-09-27 02:32:17.181 UTC LOG:aborting any active transactions
2023-09-27 02:32:17.434 UTC LOG:background worker "logical replication launcher" (PID 26) exited with exit code 1
2023-09-27 02:32:17.481 UTC LOG:shutting down
2023-09-27 02:32:17.880 UTC LOG:database system is shut downPostgres "invalid resource manager ID in primary checkpoint record" and "could not locate a valid checkpoint record"
2023-09-27 02:33:23.189 UTC LOG:starting PostgreSQL 13.5 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit
2023-09-27 02:33:23.190 UTC LOG:listening on IPv4 address "0.0.0.0", port 5432
2023-09-27 02:33:23.190 UTC LOG:listening on IPv6 address "::", port 5432
2023-09-27 02:33:23.199 UTC LOG:listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-09-27 02:33:23.210 UTC LOG:database system was shut down at 2023-09-27 02:32:22 UTC
2023-09-27 02:33:23.210 UTC LOG:invalid resource manager ID in primary checkpoint record
2023-09-27 02:33:23.210 UTC PANIC:could not locate a valid checkpoint record
2023-09-27 02:33:24.657 UTC LOG:startup process (PID 21) was terminated by signal 6: Aborted
2023-09-27 02:33:24.657 UTC LOG:aborting startup due to startup process failure
2023-09-27 02:33:24.659 UTC LOG:database system is shut down如上, WAL文件已损坏, 应该如何恢复?
恢复步骤

<blockquote>

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: 运行在容器中Postgres数据库数据损坏后如何恢复?