首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从s3使用pgbackrest恢复postgres集群时出错

从s3使用pgbackrest恢复postgres集群时出错
EN

Stack Overflow用户
提问于 2021-06-23 16:55:59
回答 1查看 174关注 0票数 0

我想通过pgbackrest使用来自s3的备份来测试恢复群集

我有: OpenShift 4.7PGO镜像标签: centos8-13.2-4.6.2 Postgres version13

如何重现:

Step1:我安装了crunchy operator并创建了集群:

代码语言:javascript
复制
pgo create cluster example-db \
  --pgbouncer \
  --replica-count=1 \
  --password-superuser="%%%%%" \
  --password-replication="%%%%%" \
  --database test-db \
  --username test-user \
  --password="%%%%%%" \
  --pvc-size 20Gi \
  --pgbackrest-pvc-size 40Gi \
  --metrics \
  --pgbackrest-storage-type=s3 \
  --pgbackrest-s3-key=test-db-backup-rw \
  --pgbackrest-s3-key-secret=%%%%% \
  --pgbackrest-s3-bucket=test-db-backup \
  --pgbackrest-s3-endpoint=s3.my_site.com \
  --pgbackrest-s3-uri-style=path \
  --pgbackrest-s3-verify-tls=false

没问题的。

步骤2:创建备份

代码语言:javascript
复制
pgo backup example-db --backup-opts="--type=full --repo1-retention-full=3 --archive-timeout=300" --pgbackrest-storage-type=s3

这也没问题。

步骤3:移除集群(模拟这个集群的丢失)。

代码语言:javascript
复制
pgo delete cluster example-db

备份仍保留在s3中。

第4步:我正在尝试通过创建备用群集来恢复此群集

代码语言:javascript
复制
pgo create cluster standby-test-db \
  --standby \
  --pgbouncer \
  --replica-count=1 \
  --password-superuser="%%%%%" \
  --password-replication="%%%%" \
  --database test-db \
  --username test-user \
  --password="%%%%" \
  --pvc-size 20Gi \
  --pgbackrest-pvc-size 40Gi \
  --metrics \
  --pgbackrest-storage-type=s3 \
  --pgbackrest-s3-key=test-db-backup-rw \
  --pgbackrest-s3-key-secret=%%%%% \
  --pgbackrest-s3-bucket=test-db-backup \
  --pgbackrest-s3-endpoint=s3.my_site.com \
  --pgbackrest-s3-uri-style=path \
  --pgbackrest-s3-verify-tls=false \
  --pgbackrest-repo-path=/backrestrepo/example-db-backrest-shared-repo

我在我的pod中得到了很多相同的警告:

代码语言:javascript
复制
...
�[0;33mTue Jun 22 16:30:16 UTC 2021 WARN: Detected an earlier failed attempt to initialize�[0m
�[0;32mTue Jun 22 16:30:16 UTC 2021 INFO: Correct the issue, remove '/pgdata/standby-test-db.initializing', and try again�[0m
�[0;32mTue Jun 22 16:30:16 UTC 2021 INFO: Your data might be in: /pgdata/standby-test-db_*�[0m
�[0;33mTue Jun 22 16:30:26 UTC 2021 WARN: Detected an earlier failed attempt to initialize�[0m
�[0;32mTue Jun 22 16:30:26 UTC 2021 INFO: Correct the issue, remove '/pgdata/standby-test-db.initializing', and try again�[0m
�[0;32mTue Jun 22 16:30:26 UTC 2021 INFO: Your data might be in: /pgdata/standby-test-db_*�[0m
...

如果我删除了/pgdata/standby-test-db_*,那么如果我重新启动pod - /pgdata/standby-test-db_*,它不会改变消息--/pgdata/standby-test-db_*会被再次创建。

我完全搞不懂这个问题。

EN

回答 1

Stack Overflow用户

发布于 2021-06-28 23:58:50

我研究了这个问题,发现pgbackrest找不到正确的完整备份。我重新创建了一个完整备份,问题就解决了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68096665

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档