@@ -737,10 +737,14 @@ source cluster. If you create it in the same Kubernetes environment, use a
737737different name.
738738
739739` ` ` yaml
740+ apiVersion: "acid.zalan.do/v1"
741+ kind: postgresql
742+ metadata:
743+ name: acid-minimal-cluster-clone
740744spec:
741745 clone:
742746 uid: "efd12e58-5786-11e8-b5a7-06148230260c"
743- cluster: "acid-batman "
747+ cluster: "acid-minimal-cluster "
744748 timestamp: "2017-12-19T12:40:33+01:00"
745749 s3_wal_path: "s3://<bucketname>/spilo/<source_db_cluster>/<UID>/wal/<PGVERSION>"
746750` ` `
@@ -756,7 +760,7 @@ specified `uid`. You can find the UID of the source cluster in its metadata:
756760apiVersion: acid.zalan.do/v1
757761kind: postgresql
758762metadata:
759- name: acid-batman
763+ name: acid-minimal-cluster
760764 uid: efd12e58-5786-11e8-b5a7-06148230260c
761765` ` `
762766
@@ -767,7 +771,7 @@ implementations:
767771spec:
768772 clone:
769773 uid: "efd12e58-5786-11e8-b5a7-06148230260c"
770- cluster: "acid-batman "
774+ cluster: "acid-minimal-cluster "
771775 timestamp: "2017-12-19T12:40:33+01:00"
772776 s3_endpoint: https://s3.acme.org
773777 s3_access_key_id: 0123456789abcdef0123456789abcdef
@@ -788,11 +792,49 @@ namespace.
788792` ` ` yaml
789793spec:
790794 clone:
791- cluster: "acid-batman "
795+ cluster: "acid-minimal-cluster "
792796` ` `
793797
794798Be aware that on a busy source database this can result in an elevated load!
795799
800+ # # Restore in place
801+
802+ There is also a possibility to restore a database without cloning it. The
803+ advantage to this is that there is no need to change anything on the
804+ application side. However, as it involves deleting the database first, this
805+ process is of course riskier than cloning (which involves adjusting the
806+ connection parameters of the app).
807+
808+ First, make sure there is no writing activity on your DB, and save the UID.
809+ Then delete the `postgresql` K8S resource :
810+
811+ ` ` ` bash
812+ zkubectl delete postgresql acid-test-restore
813+ ` ` `
814+
815+ Then deploy a new manifest with the same name, referring to itself
816+ (both name and UID) in the `clone` section :
817+
818+ ` ` ` yaml
819+ metadata:
820+ name: acid-minimal-cluster
821+ # [...]
822+ spec:
823+ # [...]
824+ clone:
825+ cluster: "acid-minimal-cluster" # the same as metadata.name above!
826+ uid: "<original_UID>"
827+ timestamp: "2022-04-01T10:11:12.000+00:00"
828+ ` ` `
829+
830+ This will create a new database cluster with the same name but different UID,
831+ whereas the database will be in the state it was at the specified time.
832+
833+ :warning : The backups and WAL files for the original DB are retained under the
834+ original UID, making it possible retry restoring. However, it is probably
835+ better to create a temporary clone for experimenting or finding out to which
836+ point you should restore.
837+
796838# # Setting up a standby cluster
797839
798840Standby cluster is a [Patroni feature](https://github.com/zalando/patroni/blob/master/docs/replica_bootstrap.rst#standby-cluster)
0 commit comments