簡體   English   中英

使用 pgbackrest 從 s3 恢復 postgres 集群時出錯

[英]Errors when recovering postgres cluster with pgbackrest from s3

我想通過 pgbackrest 使用來自 s3 的備份來測試恢復集群

我有:OpenShift 4.7 PGO 圖像標簽:centos8-13.2-4.6.2 Postgres Version 13

如何重現:

步驟1:我安裝crunchy operator並創建集群:

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 步:我創建備份

pgo backup example-db --backup-opts="--type=full --repo1-retention-full=3 --archive-timeout=300" --pgbackrest-storage-type=s3

那也沒關系。

第 3 步:我刪除集群(模擬此集群的丟失)。

pgo delete cluster example-db

備份仍保留在 s3 中。

第 4 步:我正在嘗試通過創建備用集群來恢復此集群

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 中收到了很多相同的警告:

...
�[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_* 將再次創建。

我對這個問題完全困惑。

我研究了這個問題,結果發現 pgbackrest 沒有找到正確的完整備份。 我重新創建了完整備份,問題解決了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM