wip
This commit is contained in:
@@ -110,15 +110,14 @@ repmgr_setup_conf() {
|
|||||||
printf "node_id = %s\n" "$REPMGR_NODE_ID"
|
printf "node_id = %s\n" "$REPMGR_NODE_ID"
|
||||||
printf "node_name = %s\n" "$REPMGR_NODE_NAME"
|
printf "node_name = %s\n" "$REPMGR_NODE_NAME"
|
||||||
printf "conninfo = 'host=%s dbname=repmgr user=repmgr connect_timeout=2'\n" "$REPMGR_NODE_NAME"
|
printf "conninfo = 'host=%s dbname=repmgr user=repmgr connect_timeout=2'\n" "$REPMGR_NODE_NAME"
|
||||||
printf "location = '%s'\n" "$REPMGR_NODE_LOCATION"
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "data_directory = '/var/lib/postgresql/data'\n"
|
printf "data_directory = '/var/lib/postgresql/data'\n"
|
||||||
printf "use_replication_slots = on\n"
|
printf "use_replication_slots = on\n"
|
||||||
printf "pg_bindir = '/usr/lib/postgresql/15/bin/'\n"
|
printf "pg_bindir = '/usr/lib/postgresql/15/bin/'\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "failover = automatic\n"
|
printf "failover = automatic\n"
|
||||||
printf "promote_command = '/usr/bin/repmgr standby promote -f /etc/repmgr/repmgr.conf --log-to-file'\n"
|
printf "promote_command = '/usr/bin/repmgr standby promote -f /etc/repmgr.conf --log-to-file'\n"
|
||||||
printf "follow_command = '/usr/bin/repmgr standby follow -f /etc/repmgr/repmgr.conf --log-to-file --upstream-node-id=%n'\n"
|
printf "follow_command = '/usr/bin/repmgr standby follow -f /etc/repmgr.conf --log-to-file --upstream-node-id=%n'\n"
|
||||||
printf "reconnect_attempts = 3\n"
|
printf "reconnect_attempts = 3\n"
|
||||||
printf "reconnect_interval = 5\n"
|
printf "reconnect_interval = 5\n"
|
||||||
} > /etc/repmgr/repmgr.conf
|
} > /etc/repmgr/repmgr.conf
|
||||||
@@ -153,19 +152,19 @@ if [[ ! -s "$PGDATA/PG_VERSION" ]]; then
|
|||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
|
||||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf primary register
|
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf primary register
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
until /usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr/repmgr.conf standby clone --dry-run &> /dev/null
|
until /usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr.conf standby clone --dry-run &> /dev/null
|
||||||
do
|
do
|
||||||
echo "Upstream host not ready. Waiting for 5 minutes..."
|
echo "Upstream host not ready. Waiting for 5 minutes..."
|
||||||
sleep 300
|
sleep 300
|
||||||
done
|
done
|
||||||
echo "Upstream host found..."
|
echo "Upstream host found..."
|
||||||
/usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr/repmgr.conf standby clone
|
/usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr.conf standby clone
|
||||||
docker_temp_server_start
|
docker_temp_server_start
|
||||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf standby register --force
|
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr.conf standby register --force
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -177,7 +176,7 @@ set -m
|
|||||||
postgres &
|
postgres &
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
repmgrd -f /etc/repmgr/repmgr.conf --pid-file /tmp/repmgrd.pid
|
repmgrd -f /etc/repmgr.conf --pid-file /tmp/repmgrd.pid
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|||||||
Reference in New Issue
Block a user