start repmgrd

This commit is contained in:
Bernhard Radermacher
2026-02-20 14:17:14 +01:00
parent 471b445fe6
commit 1b6a43f113
4 changed files with 14 additions and 0 deletions

View File

@@ -8,5 +8,6 @@ RUN apt-get update && \
COPY --chmod=666 repmgr.conf /etc/repmgr.conf
COPY --chmod=644 --chown=postgres profile /var/lib/postgresql/.profile
COPY --chmod=755 postgres.sh /usr/local/bin/postgres
COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/

View File

@@ -69,6 +69,7 @@ case "$REPMGR_NODE_ROLE" in
echo "hot_standby = on" >> /var/lib/postgresql/data/postgresql.conf
echo "max_wal_senders = 10" >> /var/lib/postgresql/data/postgresql.conf
echo "max_replication_slots = 10" >> /var/lib/postgresql/data/postgresql.conf
echo "shared_preload_libraries = 'repmgr'" >> /var/lib/postgresql/data/postgresql.conf
if [[ -n $POSTGRES_MAX_CONNECTIONS ]]; then
echo "max_connections = ${POSTGRES_MAX_CONNECTIONS}" >> /var/lib/postgresql/data/postgresql.conf
fi

7
postgres.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
repmgrd -f /etc/repmgr.conf --pid-file /tmp/repmgrd.pid &
export PATH="/usr/lib/postgresql/15/bin:${PATH}"
exec "$@"

View File

@@ -1,3 +1,8 @@
data_directory = '/var/lib/postgresql/data'
use_replication_slots = on
pg_bindir = '/usr/lib/postgresql/15/bin/'
failover = automatic
promote_command = '/usr/bin/repmgr standby promote -f /etc/repmgr.conf --log-to-file'
follow_command = '/usr/bin/repmgr standby follow -f /etc/repmgr.conf --log-to-file --upstream-node-id=%n'
primary_visibility_consensus = on