mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 20:11:54 +02:00
Connection pooler for replica (#1127)
* Enable connection pooler for replica * Refactor code for connection pooler - Move all the relevant code to a separate file - Move all the related tests to a separate file - Avoid using cluster where not required - Simplify the logic in sync and other methods - Cleanup of duplicated or unused code * Fix labels for the replica pods * Update deleteConnectionPooler to include role * Adding test cases and other changes - Fix unit test and delete secret when required only - Make sure we use empty fresh cluster for every test case. * enhance e2e test * Disable pooler in complete manifest as this is source for e2e too an creates unnecessary pooler setups. Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de> Co-authored-by: Jan Mussler <janm81@gmail.com>
This commit is contained in:
co-authored by
Rafia Sabih
Jan Mussler
parent
3fed565328
commit
49158ecb68
@@ -151,10 +151,15 @@ These parameters are grouped directly under the `spec` key in the manifest.
|
||||
configured (so you can override the operator configuration). Optional.
|
||||
|
||||
* **enableConnectionPooler**
|
||||
Tells the operator to create a connection pooler with a database. If this
|
||||
field is true, a connection pooler deployment will be created even if
|
||||
Tells the operator to create a connection pooler with a database for the master
|
||||
service. If this field is true, a connection pooler deployment will be created even if
|
||||
`connectionPooler` section is empty. Optional, not set by default.
|
||||
|
||||
* **enableReplicaConnectionPooler**
|
||||
Tells the operator to create a connection pooler with a database for the replica
|
||||
service. If this field is true, a connection pooler deployment for replica
|
||||
will be created even if `connectionPooler` section is empty. Optional, not set by default.
|
||||
|
||||
* **enableLogicalBackup**
|
||||
Determines if the logical backup of this cluster should be taken and uploaded
|
||||
to S3. Default: false. Optional.
|
||||
@@ -241,10 +246,10 @@ explanation of `ttl` and `loop_wait` parameters.
|
||||
|
||||
* **synchronous_mode**
|
||||
Patroni `synchronous_mode` parameter value. The default is set to `false`. Optional.
|
||||
|
||||
|
||||
* **synchronous_mode_strict**
|
||||
Patroni `synchronous_mode_strict` parameter value. Can be used in addition to `synchronous_mode`. The default is set to `false`. Optional.
|
||||
|
||||
|
||||
## Postgres container resources
|
||||
|
||||
Those parameters define [CPU and memory requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
|
||||
@@ -397,8 +402,10 @@ CPU and memory limits for the sidecar container.
|
||||
|
||||
Parameters are grouped under the `connectionPooler` top-level key and specify
|
||||
configuration for connection pooler. If this section is not empty, a connection
|
||||
pooler will be created for a database even if `enableConnectionPooler` is not
|
||||
present.
|
||||
pooler will be created for master service only even if `enableConnectionPooler`
|
||||
is not present. But if this section is present then it defines the configuration
|
||||
for both master and replica pooler services (if `enableReplicaConnectionPooler`
|
||||
is enabled).
|
||||
|
||||
* **numberOfInstances**
|
||||
How many instances of connection pooler to create.
|
||||
|
||||
+7
-1
@@ -807,11 +807,17 @@ manifest:
|
||||
```yaml
|
||||
spec:
|
||||
enableConnectionPooler: true
|
||||
enableReplicaConnectionPooler: true
|
||||
```
|
||||
|
||||
This will tell the operator to create a connection pooler with default
|
||||
configuration, through which one can access the master via a separate service
|
||||
`{cluster-name}-pooler`. In most of the cases the
|
||||
`{cluster-name}-pooler`. With the first option, connection pooler for master service
|
||||
is created and with the second option, connection pooler for replica is created.
|
||||
Note that both of these flags are independent of each other and user can set or
|
||||
unset any of them as per their requirements without any effect on the other.
|
||||
|
||||
In most of the cases the
|
||||
[default configuration](reference/operator_parameters.md#connection-pooler-configuration)
|
||||
should be good enough. To configure a new connection pooler individually for
|
||||
each Postgres cluster, specify:
|
||||
|
||||
Reference in New Issue
Block a user