You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can use the generated secret of the `postgres` robot user to connect to our `acid-minimal-cluster` master running in Minikube:
49
49
50
50
```bash
51
-
$ export PGHOST=db_host
52
-
$ export PGPORT=db_port
53
-
$ export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}'| base64 -d)
54
-
$ psql -U postgres
51
+
$ export PGHOST=db_host
52
+
$ export PGPORT=db_port
53
+
$ export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}'| base64 -d)
54
+
$ psql -U postgres
55
55
```
56
56
57
57
# Defining database roles in the operator
@@ -162,14 +162,14 @@ definitions will be ignored with a prior warning.
162
162
See [infrastructure roles secret](https://github.com/zalando-incubator/postgres-operator/blob/master/manifests/infrastructure-roles.yaml)
163
163
and [infrastructure roles configmap](https://github.com/zalando-incubator/postgres-operator/blob/master/manifests/infrastructure-roles-configmap.yaml) for the examples.
164
164
165
-
#### Use taints and tolerations for dedicated PostgreSQL nodes
165
+
## Use taints and tolerations for dedicated PostgreSQL nodes
166
166
167
167
To ensure Postgres pods are running on nodes without any other application
168
168
pods, you can use
169
169
[taints and tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)
170
170
and configure the required toleration in the manifest.
171
171
172
-
```
172
+
```yaml
173
173
apiVersion: "acid.zalan.do/v1"
174
174
kind: postgresql
175
175
metadata:
@@ -181,3 +181,64 @@ spec:
181
181
operator: Exists
182
182
effect: NoSchedule
183
183
```
184
+
185
+
## How to clone an existing PostgreSQL cluster
186
+
187
+
You can spin up a new cluster as a clone of the existing one, using a clone
188
+
section in the spec. There are two options here:
189
+
190
+
* Clone directly from a source cluster using `pg_basebackup`
191
+
192
+
* Clone from an S3 bucket
193
+
194
+
### Clone directly
195
+
196
+
```yaml
197
+
apiVersion: "acid.zalan.do/v1"
198
+
kind: postgresql
199
+
200
+
metadata:
201
+
name: acid-test-cluster
202
+
spec:
203
+
clone:
204
+
cluster: "acid-batman"
205
+
```
206
+
207
+
Here `cluster` is a name of a source cluster that is going to be cloned. The
208
+
cluster to clone is assumed to be running and the clone procedure invokes
209
+
`pg_basebackup`from it. The operator will connect to the service by name (if
210
+
the cluster is called test, then the connection string will look like host=test
211
+
port=5432), which means that you can clone only from clusters running in the
212
+
default namespace.
213
+
214
+
### Clone from S3
215
+
216
+
```yaml
217
+
apiVersion: "acid.zalan.do/v1"
218
+
kind: postgresql
219
+
220
+
metadata:
221
+
name: acid-test-cluster
222
+
spec:
223
+
clone:
224
+
uid: "efd12e58-5786-11e8-b5a7-06148230260c"
225
+
cluster: "acid-batman"
226
+
timestamp: "2017-12-19T12:40:33+01:00"
227
+
```
228
+
229
+
Here `cluster` is a name of a source cluster that is going to be cloned. A new
230
+
cluster will be cloned from S3, using the latest backup before the
231
+
`timestamp`. In this case, `uid` field is also mandatory - operator will use it
232
+
to find a correct key inside an S3 bucket. You can find this field from
233
+
metadata of a source cluster:
234
+
235
+
```yaml
236
+
apiVersion: acid.zalan.do/v1
237
+
kind: postgresql
238
+
metadata:
239
+
name: acid-test-cluster
240
+
uid: efd12e58-5786-11e8-b5a7-06148230260c
241
+
```
242
+
243
+
Note that timezone required for `timestamp` (offset relative to UTC, see RFC
0 commit comments