Split into two parts and reformulate a bit

This commit is contained in:
erthalion 2018-06-04 13:41:18 +02:00
parent e661ea1ea7
commit 5151b43c82
1 changed files with 32 additions and 11 deletions

View File

@ -184,8 +184,31 @@ spec:
## How to clone an existing PostgreSQL cluster ## How to clone an existing PostgreSQL cluster
To spin up a new cluster as a clone of the existing one, you need to provide a You can spin up a new cluster as a clone of the existing one, using a clone
clone section in the spec: section in the spec. There are two options here:
* Clone directly from a source cluster using `pg_basebackup`
* Clone from an S3 bucket
### Clone directly
```yaml
apiVersion: "acid.zalan.do/v1"
kind: postgresql
metadata:
name: acid-test-cluster
spec:
clone:
cluster: "acid-batman"
```
Here `cluster` is a name of a source cluster that is going to be cloned. The
cluster to clone is assumed to be running and the clone procedure invokes
`pg_basebackup` from it.
### Clone from S3
```yaml ```yaml
apiVersion: "acid.zalan.do/v1" apiVersion: "acid.zalan.do/v1"
@ -200,12 +223,11 @@ spec:
timestamp: "2017-12-19T12:40:33+01:00" timestamp: "2017-12-19T12:40:33+01:00"
``` ```
Here `cluster` is a name of a target cluster that is going to be cloned. If Here `cluster` is a name of a source cluster that is going to be cloned. A new
`timestamp` is not empty, then a new cluster will be cloned from an S3 bucket, cluster will be cloned from an S3, using the latest backup before the
that was created by operator, `timestamp`. In this case, `uid` field is also mandatory - operator will use it
using the latest backup before the `timestamp`. In this case `uid` field is to find a correct key inside an S3 bucket. You can find this field from
also mandatory - operator will use it to find an S3 bucket. You can find this metadata of a source cluster:
field from metadata of a target cluster:
```yaml ```yaml
apiVersion: acid.zalan.do/v1 apiVersion: acid.zalan.do/v1
@ -215,6 +237,5 @@ metadata:
uid: efd12e58-5786-11e8-b5a7-06148230260c uid: efd12e58-5786-11e8-b5a7-06148230260c
``` ```
If `timestamp` is empty or absent, a new cluster will be cloned from an Note that timezone required for `timestamp` (offset relative to UTC, see RFC
existing alive cluster using pg_basebackup. Note that timezone required for 3339 section 5.6)
`timestamp` (offset relative to UTC, see RFC 3339 section 5.6)