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

打印 上一主题 下一主题

主题 803|帖子 803|积分 2409

前言

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

<blockquote>

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

悠扬随风

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表