我想通过pgbackback 使用s3的备份来测试恢复集群
我有:OpenShift 4.7PGO图像标签:centos8-13.2-4.6.2Postgres版本13
如何复制:
第1步:我安装crunchy操作符并创建集群:
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
我的吊舱里收到了很多相同的警告:
...
�[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/ststandby-test-db_*,它不会更改消息如果我重新启动pod,将再次创建/pgdata/ststandby-test-db_*。
我对这个问题完全感到困惑。
我研究了这个问题,结果发现pgbackback没有找到正确的完整备份。我重新创建了一个完整备份,问题就解决了。