mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
doc: update "node rejoin" documentation
In particular, update examples to reflect changed output in repmgr 4.3.
This commit is contained in:
@@ -216,6 +216,10 @@
|
|||||||
postgres --single -D /var/lib/pgsql/data/ < /dev/null</programlisting>
|
postgres --single -D /var/lib/pgsql/data/ < /dev/null</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
<para>
|
||||||
|
&repmgr; will attempt to verify whether the node can rejoin as-is, or whether
|
||||||
|
<command>pg_rewind</command> must be used (see following section).
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1 id="repmgr-node-rejoin-pg-rewind" xreflabel="Using pg_rewind">
|
<refsect1 id="repmgr-node-rejoin-pg-rewind" xreflabel="Using pg_rewind">
|
||||||
@@ -241,65 +245,92 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
We strongly recommend familiarizing yourself with <command>pg_rewind</command> before attempting
|
||||||
|
to use it with &repmgr;, as while it is an extremely useful tool, it is <emphasis>not</emphasis>
|
||||||
|
a "magic bullet".
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
A typical use-case for <command>pg_rewind</command> is when a scenario like the following
|
||||||
|
is encountered:
|
||||||
|
<programlisting>
|
||||||
|
$ repmgr node rejoin -f /etc/repmgr.conf -d 'host=node3 dbname=repmgr user=repmgr' \
|
||||||
|
--force-rewind --config-files=postgresql.local.conf,postgresql.conf --verbose --dry-run
|
||||||
|
INFO: replication connection to the follow target node was successful
|
||||||
|
INFO: local and follow target system identifiers match
|
||||||
|
DETAIL: system identifier is 6652184002263212600
|
||||||
|
ERROR: this node cannot attach to follow target node 3
|
||||||
|
DETAIL: follow target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/610D710
|
||||||
|
HINT: use --force-rewind to execute pg_rewind</programlisting>
|
||||||
|
|
||||||
|
Here, <literal>node3</literal> was promoted to a primary while the local node was
|
||||||
|
still attached to the previous primary; this can potentially happen during e.g. a
|
||||||
|
network split. <command>pg_rewind</command> can re-sync the local node with <literal>node3</literal>,
|
||||||
|
removing the need for a full reclone.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
To have <command>repmgr node rejoin</command> use <command>pg_rewind</command>,
|
To have <command>repmgr node rejoin</command> use <command>pg_rewind</command>,
|
||||||
pass the command line option <literal>--force-rewind</literal>, which will tell &repmgr;
|
pass the command line option <literal>--force-rewind</literal>, which will tell &repmgr;
|
||||||
to execute <command>pg_rewind</command> to ensure the node can be rejoined successfully.
|
to execute <command>pg_rewind</command> to ensure the node can be rejoined successfully.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<important>
|
||||||
Be aware that if <command>pg_rewind</command> is executed and actually performs a
|
<para>
|
||||||
rewind operation, any configuration files in the PostgreSQL data directory will be
|
Be aware that if <command>pg_rewind</command> is executed and actually performs a
|
||||||
overwritten with those from the source server.
|
rewind operation, any configuration files in the PostgreSQL data directory will be
|
||||||
</para>
|
overwritten with those from the source server.
|
||||||
<para>
|
</para>
|
||||||
To prevent this happening, provide a comma-separated list of files to retain
|
<para>
|
||||||
using the <literal>--config-file</literal> command line option; the specified files
|
To prevent this happening, provide a comma-separated list of files to retain
|
||||||
will be archived in a temporary directory (whose parent directory can be specified with
|
using the <literal>--config-file</literal> command line option; the specified files
|
||||||
<literal>--config-archive-dir</literal>) and restored once the rewind operation is
|
will be archived in a temporary directory (whose parent directory can be specified with
|
||||||
complete.
|
<literal>--config-archive-dir</literal>) and restored once the rewind operation is
|
||||||
</para>
|
complete.
|
||||||
|
</para>
|
||||||
|
</important>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Example, first using <literal>--dry-run</literal>, then actually executing the
|
Example, first using <literal>--dry-run</literal>, then actually executing the
|
||||||
<literal>node rejoin command</literal>.
|
<literal>node rejoin command</literal>.
|
||||||
<programlisting>
|
<programlisting>
|
||||||
$ repmgr node rejoin -f /etc/repmgr.conf -d 'host=node1 dbname=repmgr user=repmgr' \
|
$ repmgr node rejoin -f /etc/repmgr.conf -d 'host=node3 dbname=repmgr user=repmgr' \
|
||||||
--force-rewind --config-files=postgresql.local.conf,postgresql.conf --verbose --dry-run
|
--config-files=postgresql.local.conf,postgresql.conf --verbose --force-rewind --dry-run
|
||||||
NOTICE: using provided configuration file "/etc/repmgr.conf"
|
INFO: replication connection to the follow target node was successful
|
||||||
|
INFO: local and follow target system identifiers match
|
||||||
|
DETAIL: system identifier is 6652460429293670710
|
||||||
|
NOTICE: pg_rewind execution required for this node to attach to follow target node 3
|
||||||
|
DETAIL: follow target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/610D710
|
||||||
INFO: prerequisites for using pg_rewind are met
|
INFO: prerequisites for using pg_rewind are met
|
||||||
INFO: file "postgresql.local.conf" would be copied to "/tmp/repmgr-config-archive-node1/postgresql.local.conf"
|
INFO: file "postgresql.local.conf" would be copied to "/tmp/repmgr-config-archive-node2/postgresql.local.conf"
|
||||||
INFO: file "postgresql.conf" would be copied to "/tmp/repmgr-config-archive-node1/postgresql.local.conf"
|
INFO: file "postgresql.replication-setup.conf" would be copied to "/tmp/repmgr-config-archive-node2/postgresql.replication-setup.conf"
|
||||||
INFO: 2 files would have been copied to "/tmp/repmgr-config-archive-node1"
|
|
||||||
INFO: directory "/tmp/repmgr-config-archive-node1" deleted
|
|
||||||
INFO: pg_rewind would now be executed
|
INFO: pg_rewind would now be executed
|
||||||
DETAIL: pg_rewind command is:
|
DETAIL: pg_rewind command is:
|
||||||
pg_rewind -D '/var/lib/postgresql/data' --source-server='host=node1 dbname=repmgr user=repmgr'</programlisting>
|
pg_rewind -D '/var/lib/postgresql/data' --source-server='host=node3 dbname=repmgr user=repmgr'
|
||||||
|
INFO: prerequisites for executing NODE REJOIN are met</programlisting>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
If <option>--force-rewind</option> is used with the <option>--dry-run</option> option,
|
If <option>--force-rewind</option> is used with the <option>--dry-run</option> option,
|
||||||
this checks the prerequisites for using <application>pg_rewind</application>, but cannot
|
this checks the prerequisites for using <application>pg_rewind</application>, but is
|
||||||
predict the outcome of actually executing <application>pg_rewind</application>.
|
not an absolute guarantee that actually executing <application>pg_rewind</application>
|
||||||
|
will succeed.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
$ repmgr node rejoin -f /etc/repmgr.conf -d 'host=node1 dbname=repmgr user=repmgr' \
|
$ repmgr node rejoin -f /etc/repmgr.conf -d 'host=node3 dbname=repmgr user=repmgr' \
|
||||||
--force-rewind --config-files=postgresql.local.conf,postgresql.conf --verbose
|
--config-files=postgresql.local.conf,postgresql.conf --verbose --force-rewind
|
||||||
NOTICE: using provided configuration file "/etc/repmgr.conf"
|
NOTICE: pg_rewind execution required for this node to attach to follow target node 3
|
||||||
INFO: prerequisites for using pg_rewind are met
|
DETAIL: follow target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/610D710
|
||||||
INFO: 2 files copied to "/tmp/repmgr-config-archive-node1"
|
|
||||||
NOTICE: executing pg_rewind
|
NOTICE: executing pg_rewind
|
||||||
NOTICE: 2 files copied to /var/lib/pgsql/data
|
DETAIL: pg_rewind command is "pg_rewind -D '/var/lib/postgresql/data' --source-server='host=node3 dbname=repmgr user=repmgr'"
|
||||||
INFO: directory "/tmp/repmgr-config-archive-node1" deleted
|
NOTICE: 2 files copied to /var/lib/postgresql/data
|
||||||
INFO: deleting "recovery.done"
|
NOTICE: setting node 2's upstream to node 3
|
||||||
INFO: setting node 1's primary to node 2
|
NOTICE: starting server using "pg_ctl -l /var/log/postgres/startup.log -w -D '/var/lib/pgsql/data' start"
|
||||||
NOTICE: starting server using "pg_ctl-l /var/log/postgres/startup.log -w -D '/var/lib/pgsql/data' start"
|
|
||||||
waiting for server to start.... done
|
|
||||||
server started
|
|
||||||
NOTICE: NODE REJOIN successful
|
NOTICE: NODE REJOIN successful
|
||||||
DETAIL: node 1 is now attached to node 2</programlisting>
|
DETAIL: node 2 is now attached to node 3</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|||||||
Reference in New Issue
Block a user