Skip to content

Commit ec8d911

Browse files
author
Jonathan S. Katz
committed
Update custom configuration docs to clearly specify creation case
This was handled in the tutorial, but not in the "Advanced Topics" section. Issue: CrunchyData#2222
1 parent 98529f2 commit ec8d911

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/content/advanced/custom-configuration.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,46 @@ files that ship with the Crunchy Postgres container, there is no
7575
requirement to. In this event, continue using the Operator as usual
7676
and avoid defining a global configMap.
7777

78+
## Create a PostgreSQL Cluster With Custom Configuration
79+
80+
The PostgreSQL Operator allows for a PostgreSQL cluster to be created with a customized configuration. To do this, one must create a ConfigMap with an entry called `postgres-ha.yaml` that contains the custom configuration. The custom configuration follows the [Patorni YAML format](https://access.crunchydata.com/documentation/patroni/latest/settings/). Note that parameters that are placed in the `bootstrap` section are applied once during cluster initialization. Editing these values in a working cluster require following the [Modifying PostgreSQL Cluster Configuration](#modifying-postgresql-cluster-configuration) section.
81+
82+
For example, let's say we want to create a PostgreSQL cluster with `shared_buffers` set to `2GB`, `max_connections` set to `30` and `password_encryption` set to `scram-sha-256`. We would create a configuration file that looks similar to:
83+
84+
```
85+
---
86+
bootstrap:
87+
dcs:
88+
postgresql:
89+
parameters:
90+
max_connections: 30
91+
shared_buffers: 2GB
92+
password_encryption: scram-sha-256
93+
```
94+
95+
Save this configuration in a file called `postgres-ha.yaml`.
96+
97+
Create a [`ConfigMap`](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) like so:
98+
99+
```
100+
kubectl -n pgo create configmap hippo-custom-config --from-file=postgres-ha.yaml
101+
```
102+
103+
You can then have you new PostgreSQL cluster use `hippo-custom-config` as part of its cluster initialization by using the `--custom-config` flag of `pgo create cluster`:
104+
105+
```
106+
pgo create cluster hippo -n pgo --custom-config=hippo-custom-config
107+
```
108+
109+
After your cluster is initialized, [connect to your cluster]({{< relref "tutorial/connect-cluster.md" >}}) and confirm that your settings have been applied:
110+
111+
```
112+
SHOW shared_buffers;
113+
114+
shared_buffers
115+
----------------
116+
2GB
117+
```
78118

79119
## Modifying PostgreSQL Cluster Configuration
80120

0 commit comments

Comments
 (0)