fix register standby
This commit is contained in:
@@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
source /usr/local/bin/docker-entrypoint.sh
|
source /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
|
server_start() {
|
||||||
|
NOTIFY_SOCKET= \
|
||||||
|
PGUSER="${PGUSER:-$POSTGRES_USER}" \
|
||||||
|
pg_ctl -D "$PGDATA" \
|
||||||
|
-o "-c listen_addresses='*' -p ${PGPORT:-5432}" \
|
||||||
|
-w start
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# the variable UPSTREAM indicates that a standby instance is requested, otherwise this is primary
|
# the variable UPSTREAM indicates that a standby instance is requested, otherwise this is primary
|
||||||
if [[ -z $UPSTREAM ]]; then
|
if [[ -z $UPSTREAM ]]; then
|
||||||
|
|
||||||
@@ -11,7 +20,6 @@ if [[ -z $UPSTREAM ]]; then
|
|||||||
|
|
||||||
docker_temp_server_stop
|
docker_temp_server_stop
|
||||||
|
|
||||||
|
|
||||||
# ensure required entries in configuration
|
# ensure required entries in configuration
|
||||||
# shellcheck disable=SC2129
|
# shellcheck disable=SC2129
|
||||||
# echo "archive_command = 'cp %p ${WAL_ARCHIVE:-/wal_archive}/%f'" >> /var/lib/postgresql/data/postgresql.conf
|
# echo "archive_command = 'cp %p ${WAL_ARCHIVE:-/wal_archive}/%f'" >> /var/lib/postgresql/data/postgresql.conf
|
||||||
@@ -46,12 +54,7 @@ if [[ -z $UPSTREAM ]]; then
|
|||||||
echo "max_connections = ${MAX_CONNECTIONS}" >> /var/lib/postgresql/data/postgresql.conf
|
echo "max_connections = ${MAX_CONNECTIONS}" >> /var/lib/postgresql/data/postgresql.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- -c listen_addresses='*' -p "${PGPORT:-5432}"
|
server_start
|
||||||
NOTIFY_SOCKET= \
|
|
||||||
PGUSER="${PGUSER:-$POSTGRES_USER}" \
|
|
||||||
pg_ctl -D "$PGDATA" \
|
|
||||||
-o "-c listen_addresses='*' -p ${PGPORT:-5432}" \
|
|
||||||
-w start
|
|
||||||
|
|
||||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf primary register
|
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf primary register
|
||||||
|
|
||||||
@@ -76,9 +79,11 @@ else
|
|||||||
echo "Upstream host not ready..."
|
echo "Upstream host not ready..."
|
||||||
sleep 300
|
sleep 300
|
||||||
done
|
done
|
||||||
|
echo "Upstream host found..."
|
||||||
/usr/lib/postgresql/15/bin/repmgr -h pg-0 -U repmgr -f /etc/repmgr.conf standby clone
|
/usr/lib/postgresql/15/bin/repmgr -h pg-0 -U repmgr -f /etc/repmgr.conf standby clone
|
||||||
|
|
||||||
|
server_start
|
||||||
|
|
||||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf standby register
|
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf standby register
|
||||||
|
|
||||||
docker_temp_server_start
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user