[bitnami/postgresql-repmgr] Release 11.18.0-debian-11-r23 (#20541)
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
parent
3c783226d4
commit
58f1b90a4f
|
|
@ -5,7 +5,7 @@ ARG TARGETARCH
|
|||
LABEL org.opencontainers.image.authors="https://bitnami.com/contact" \
|
||||
org.opencontainers.image.description="Application packaged by Bitnami" \
|
||||
org.opencontainers.image.licenses="Apache-2.0" \
|
||||
org.opencontainers.image.ref.name="11.18.0-debian-11-r22" \
|
||||
org.opencontainers.image.ref.name="11.18.0-debian-11-r23" \
|
||||
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/postgresql-repmgr" \
|
||||
org.opencontainers.image.title="postgresql-repmgr" \
|
||||
org.opencontainers.image.vendor="VMware, Inc." \
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ repmgr_validate() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$REPMGR_NODE_TYPE" ]] || ! [[ "$REPMGR_NODE_TYPE" =~ ^(data|witness)$ ]]; then
|
||||
print_validation_error "Set the environment variable REPMGR_NODE_TYPE to 'data' or 'witness'."
|
||||
fi
|
||||
|
||||
if ! is_yes_no_value "$REPMGR_PGHBA_TRUST_ALL"; then
|
||||
print_validation_error "The allowed values for REPMGR_PGHBA_TRUST_ALL are: yes or no."
|
||||
fi
|
||||
|
|
@ -260,9 +264,17 @@ repmgr_set_role() {
|
|||
primary_host=${primary_node[0]}
|
||||
primary_port=${primary_node[1]:-$REPMGR_PRIMARY_PORT}
|
||||
|
||||
if [[ -z "$primary_host" ]]; then
|
||||
if [[ "$REPMGR_NODE_TYPE" = "data" ]]; then
|
||||
if [[ -z "$primary_host" ]]; then
|
||||
info "There are no nodes with primary role. Assuming the primary role..."
|
||||
role="primary"
|
||||
else
|
||||
info "Node configured as standby"
|
||||
role="standby"
|
||||
fi
|
||||
else
|
||||
info "Node configured as witness"
|
||||
role="witness"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
|
@ -694,6 +706,49 @@ repmgr_unregister_standby() {
|
|||
debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
|
||||
}
|
||||
|
||||
########################
|
||||
# Unregister witness
|
||||
# Globals:
|
||||
# REPMGR_*
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
repmgr_unregister_witness() {
|
||||
info "Unregistering witness node..."
|
||||
local -r flags=("-f" "$REPMGR_CONF_FILE" "witness" "unregister" "-h" "$REPMGR_CURRENT_PRIMARY_HOST" "--verbose")
|
||||
|
||||
# The command below can fail when the node doesn't exist yet
|
||||
if [[ "$REPMGR_USE_PASSFILE" = "true" ]]; then
|
||||
PGPASSFILE="$REPMGR_PASSFILE_PATH" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
|
||||
else
|
||||
PGPASSWORD="$REPMGR_PASSWORD" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Register witness
|
||||
# Globals:
|
||||
# REPMGR_*
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
repmgr_register_witness() {
|
||||
info "Registering witness node..."
|
||||
local -r flags=("-f" "$REPMGR_CONF_FILE" "witness" "register" "-h" "$REPMGR_CURRENT_PRIMARY_HOST" "--force" "--verbose")
|
||||
|
||||
repmgr_wait_primary_node
|
||||
|
||||
if [[ "$REPMGR_USE_PASSFILE" = "true" ]]; then
|
||||
PGPASSFILE="$REPMGR_PASSFILE_PATH" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}"
|
||||
else
|
||||
PGPASSWORD="$REPMGR_PASSWORD" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Standby follow.
|
||||
# Globals:
|
||||
|
|
@ -801,7 +856,7 @@ repmgr_initialize() {
|
|||
else
|
||||
debug "Skipping repmgr configuration..."
|
||||
fi
|
||||
else
|
||||
elif [[ "$REPMGR_ROLE" = "standby" ]]; then
|
||||
local -r psql_major_version="$(postgresql_get_major_version)"
|
||||
|
||||
POSTGRESQL_MASTER_PORT_NUMBER="$REPMGR_CURRENT_PRIMARY_PORT"
|
||||
|
|
@ -819,5 +874,11 @@ repmgr_initialize() {
|
|||
repmgr_wait_primary_node
|
||||
repmgr_standby_follow
|
||||
fi
|
||||
elif [[ "$REPMGR_ROLE" = "witness" ]]; then
|
||||
postgresql_start_bg
|
||||
repmgr_create_repmgr_user
|
||||
repmgr_create_repmgr_db
|
||||
repmgr_unregister_witness
|
||||
repmgr_register_witness
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ postgresql_env_vars=(
|
|||
REPMGR_NODE_NETWORK_NAME
|
||||
REPMGR_NODE_PRIORITY
|
||||
REPMGR_NODE_LOCATION
|
||||
REPMGR_NODE_TYPE
|
||||
REPMGR_PORT_NUMBER
|
||||
REPMGR_LOG_LEVEL
|
||||
REPMGR_USE_PGREWIND
|
||||
|
|
@ -395,6 +396,7 @@ export REPMGR_NODE_NAME="${REPMGR_NODE_NAME:-$(hostname)}"
|
|||
export REPMGR_NODE_NETWORK_NAME="${REPMGR_NODE_NETWORK_NAME:-}"
|
||||
export REPMGR_NODE_PRIORITY="${REPMGR_NODE_PRIORITY:-100}"
|
||||
export REPMGR_NODE_LOCATION="${REPMGR_NODE_LOCATION:-default}"
|
||||
export REPMGR_NODE_TYPE="${REPMGR_NODE_TYPE:-data}"
|
||||
export REPMGR_PORT_NUMBER="${REPMGR_PORT_NUMBER:-5432}"
|
||||
export REPMGR_LOG_LEVEL="${REPMGR_LOG_LEVEL:-NOTICE}"
|
||||
export REPMGR_USE_PGREWIND="${REPMGR_USE_PGREWIND:-no}"
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ A HA PostgreSQL cluster with [Streaming replication](https://www.postgresql.org/
|
|||
- `REPMGR_PRIMARY_HOST`: Hostname of the initial primary node. No defaults.
|
||||
- `REPMGR_PARTNER_NODES`: Comma separated list of partner nodes in the cluster. No defaults.
|
||||
- `REPMGR_NODE_NAME`: Node name. No defaults.
|
||||
- `REPMGR_NODE_TYPE`: Node type. Defaults to `data`. Allowed values: `data` for data nodes (master or replicas), `witness` for witness nodes.
|
||||
- `REPMGR_NODE_NETWORK_NAME`: Node hostname. No defaults.
|
||||
- `REPMGR_PGHBA_TRUST_ALL`: This will set the auth-method in the generated pg_hba.conf. Set it to `yes` only if you are using pgpool with LDAP authentication. Default to `no`.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue