February 2020
Intermediate to advanced
734 pages
38h 13m
English
For the purposes of this recipe, pgha1 will remain our primary node, and the standby will be pgha2. Follow these steps on pgha1 and pgha2, unless otherwise specified:
#!/usr/bin/env bash
VIP=10.0.30.50
IFACE=eth0
PATH=/usr/pgsql-12/bin:$PATH
VIP_CONF="${VIP}/32 dev ${IFACE} label ${IFACE}:pg"
ssh -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ConnectTimeout=5 \
-o ServerAliveInterval=1 \
postgres@${VIP} sudo ip addr del ${VIP_CONF}
sudo /sbin/ip addr add ${VIP_CONF}
sudo /usr/sbin/arping -b -A -c 3 -I ${IFACE} ${VIP}
repmgr standby promote
exit 0
Read now
Unlock full access