repmgr standby followrepmgr standby followrepmgr standby followattach a running standby to a new upstream nodeDescription
Attaches the standby to a new upstream node. This command requires a valid
repmgr.conf file for the standby, either specified
explicitly with -f/--config-file or located in a
default location; no additional arguments are required.
By default &repmgr; will attempt to attach the standby to the current primary.
If is provided, &repmgr; will attempt
to attach the standby to the specified node, which can be another standby.
This command will force a restart of the standby server, which must be
running.
To re-add an inactive node to the replication cluster, use
.
repmgr standby follow will wait up to
standby_follow_timeout seconds (default: 30)
to verify the standby has actually connected to the new upstream node.
If is set for the standby, it
will not attach to the new upstream node until it has replayed available
WAL.
Conversely, if the standby is attached follows another standby
with set, that standby's replay
state may actually be behind that of its new downstream node.
Example
$ repmgr -f /etc/repmgr.conf standby follow
INFO: setting node 3's primary to node 2
NOTICE: restarting server using "pg_ctl -l /var/log/postgres/startup.log -w -D '/var/lib/postgres/data' restart"
waiting for server to shut down........ done
server stopped
waiting for server to start.... done
server started
NOTICE: STANDBY FOLLOW successful
DETAIL: node 3 is now attached to node 2Options
Check prerequisites but don't actually follow a new standby.
This does not guarantee the standby can follow the primary; in
particular, whether the primary and standby timelines have diverged,
can currently only be determined by actually attempting to
attach the standby to the primary.
Node ID of the new primary.
This option is intended for use by repmgrd, when
instructing standbys to follow the new primary. For more details
see Automatic failover configuration.
Wait for a primary to appear. &repmgr; will wait for up to
primary_follow_timeout seconds
(default: 60 seconds) to verify that the standby is following the new primary.
This value can be defined in repmgr.conf.
Exit codes
Following exit codes can be emitted by repmgr standby follow:
No issues were detected.
&repmgr; was unable to establish a database connection to one of the nodes.
&repmgr; was unable to complete the follow command.
Event notifications
A standby_follow event notification will be generated.
If provided, &repmgr; will substitute the placeholders %p with the node ID of the primary
being followed, %c with its conninfo string, and
%a with its node name.
See also