[bitnami/postgresql-ha] Mitigate brain split situations (#9035)

* [bitnami/postgresql-ha] Mitigate brain split situations

Signed-off-by: Rafael Rios Saavedra <rafael.rios.saavedra@gmail.com>

* [bitnami/postgresql-ha] Mitigate brain split situations

Signed-off-by: Rafael Rios Saavedra <rafael.rios.saavedra@gmail.com>
This commit is contained in:
Rafael Ríos Saavedra
2022-02-17 16:36:56 +01:00
committed by GitHub
parent e42b68f81b
commit e9c2d741ee
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -27,4 +27,4 @@ name: postgresql-ha
sources:
- https://github.com/bitnami/bitnami-docker-postgresql
- https://www.postgresql.org/
version: 8.3.2
version: 8.4.0
+2 -2
View File
@@ -173,8 +173,8 @@ Additionally, if `persistence.resourcePolicy` is set to `keep`, you should manua
| `postgresql.repmgrDatabase` | PostgreSQL Repmgr database | `repmgr` |
| `postgresql.repmgrLogLevel` | Repmgr log level (DEBUG, INFO, NOTICE, WARNING, ERROR, ALERT, CRIT or EMERG) | `NOTICE` |
| `postgresql.repmgrConnectTimeout` | Repmgr backend connection timeout (in seconds) | `5` |
| `postgresql.repmgrReconnectAttempts` | Repmgr backend reconnection attempts | `3` |
| `postgresql.repmgrReconnectInterval` | Repmgr backend reconnection interval (in seconds) | `5` |
| `postgresql.repmgrReconnectAttempts` | Repmgr backend reconnection attempts | `2` |
| `postgresql.repmgrReconnectInterval` | Repmgr backend reconnection interval (in seconds) | `3` |
| `postgresql.usePgRewind` | Use pg_rewind for standby failover (experimental) | `false` |
| `postgresql.audit.logHostname` | Add client hostnames to the log file | `true` |
| `postgresql.audit.logConnections` | Add client log-in operations to the log file | `false` |
@@ -26,6 +26,9 @@ data:
. /opt/bitnami/scripts/libpostgresql.sh
. /opt/bitnami/scripts/librepmgr.sh
# Load PostgreSQL & repmgr environment variables
. /opt/bitnami/scripts/postgresql-env.sh
# Auxiliary functions
is_new_primary_ready() {
return_value=1
@@ -52,19 +55,16 @@ data:
exec 2>/dev/null
fi
# Load PostgreSQL & repmgr environment variables
. /opt/bitnami/scripts/postgresql-env.sh
postgresql_enable_nss_wrapper
# Prepare env vars for managing roles
primary_node="$(repmgr_get_primary_node)"
primary_host="$(echo $primary_node | awk '{print $1}')"
readarray -t primary_node < <(repmgr_get_upstream_node)
primary_host="${primary_node[0]}"
# Stop postgresql for graceful exit.
postgresql_stop
if [[ "$primary_host" == "$REPMGR_NODE_NETWORK_NAME" ]]; then
if [[ -z "$primary_host" ]] || [[ "$primary_host" == "$REPMGR_NODE_NETWORK_NAME" ]]; then
info "Primary node need to wait for a new primary node before leaving the cluster"
retry_while is_new_primary_ready 10 5
else
+2 -2
View File
@@ -398,8 +398,8 @@ postgresql:
repmgrDatabase: repmgr
repmgrLogLevel: NOTICE
repmgrConnectTimeout: 5
repmgrReconnectAttempts: 3
repmgrReconnectInterval: 5
repmgrReconnectAttempts: 2
repmgrReconnectInterval: 3
## EXPERMENTAL: Use pg_rewind for standby failover
## @param postgresql.usePgRewind Use pg_rewind for standby failover (experimental)
##