mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Compare commits
46 Commits
v5.5.0
...
REL4_4_STA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1337f68caf | ||
|
|
00494f1a15 | ||
|
|
1460e6400a | ||
|
|
daa7de1cd0 | ||
|
|
0fbc0f42b5 | ||
|
|
34aa54b766 | ||
|
|
01ec64c330 | ||
|
|
41637f0c43 | ||
|
|
b61989bafe | ||
|
|
c2987b6c9b | ||
|
|
c6d151ef56 | ||
|
|
867ebcb52d | ||
|
|
9abf72af07 | ||
|
|
2256c0a81f | ||
|
|
701fdd9622 | ||
|
|
5c1ca6cba5 | ||
|
|
2dce4b06b4 | ||
|
|
f1716a67b0 | ||
|
|
1d43f1cdb5 | ||
|
|
7cc12f08ed | ||
|
|
8484bc6687 | ||
|
|
d92d008cb3 | ||
|
|
38adf5daca | ||
|
|
4a8684e37b | ||
|
|
9c9f4c8c32 | ||
|
|
0e1319d788 | ||
|
|
9c784f804e | ||
|
|
13097e30f0 | ||
|
|
40b6c92129 | ||
|
|
761d65526c | ||
|
|
a13a1232e9 | ||
|
|
65965b3ba4 | ||
|
|
629d2b8f85 | ||
|
|
23c285b73b | ||
|
|
915fb7d617 | ||
|
|
ae141b9d32 | ||
|
|
d035550723 | ||
|
|
c7692b5d84 | ||
|
|
08b7f1294b | ||
|
|
81d01bf0e8 | ||
|
|
089c778e49 | ||
|
|
b4b5681762 | ||
|
|
e5ef549aa7 | ||
|
|
cfc41392c3 | ||
|
|
55dc4f7a5f | ||
|
|
6616712346 |
10
HISTORY
10
HISTORY
@@ -1,4 +1,8 @@
|
|||||||
4.4 2019-??-??
|
4.4.1 2019-??-??
|
||||||
|
repmgr: improve data directory check (Ian)
|
||||||
|
repmgr: improve extension check during "standby clone" (Ian)
|
||||||
|
|
||||||
|
4.4 2019-06-27
|
||||||
repmgr: improve "daemon status" output (Ian)
|
repmgr: improve "daemon status" output (Ian)
|
||||||
repmgr: add "--siblings-follow" option to "standby promote" (Ian)
|
repmgr: add "--siblings-follow" option to "standby promote" (Ian)
|
||||||
repmgr: add "--repmgrd-force-unpause" option to "standby switchover" (Ian)
|
repmgr: add "--repmgrd-force-unpause" option to "standby switchover" (Ian)
|
||||||
@@ -6,6 +10,8 @@
|
|||||||
an existing directory is being overwritten (Ian)
|
an existing directory is being overwritten (Ian)
|
||||||
repmgr: improve "--dry-run" behaviour for "standby promote" and
|
repmgr: improve "--dry-run" behaviour for "standby promote" and
|
||||||
"standby switchover" (Ian)
|
"standby switchover" (Ian)
|
||||||
|
repmgr: when running "standby clone" with the "--upstream-conninfo" option
|
||||||
|
ensure that "application_name" is set correctly in "primary_conninfo" (Ian)
|
||||||
repmgr: ensure "--dry-run" together with --force when running "standby clone"
|
repmgr: ensure "--dry-run" together with --force when running "standby clone"
|
||||||
in barman mode does not modify an existing data directory (Ian)
|
in barman mode does not modify an existing data directory (Ian)
|
||||||
repmgr: improve "--dry-run" output when running "standby clone" in
|
repmgr: improve "--dry-run" output when running "standby clone" in
|
||||||
@@ -21,6 +27,8 @@
|
|||||||
repmgr: prevent a witness server being registered on the cluster primary (John)
|
repmgr: prevent a witness server being registered on the cluster primary (John)
|
||||||
repmgr: ensure BDR2-specific functionality cannot be used on
|
repmgr: ensure BDR2-specific functionality cannot be used on
|
||||||
BDR3 and later (Ian)
|
BDR3 and later (Ian)
|
||||||
|
repmgr: canonicalize the data directory path (Ian)
|
||||||
|
repmgr: note that "standby follow" requires a primary to be available (Ian)
|
||||||
repmgrd: monitor standbys attached to primary (Ian)
|
repmgrd: monitor standbys attached to primary (Ian)
|
||||||
repmgrd: add "primary visibility consensus" functionality (Ian)
|
repmgrd: add "primary visibility consensus" functionality (Ian)
|
||||||
repmgrd: fix memory leak which occurs while the monitored PostgreSQL
|
repmgrd: fix memory leak which occurs while the monitored PostgreSQL
|
||||||
|
|||||||
@@ -24,4 +24,5 @@ include $(PGXS)
|
|||||||
-include ${repmgr_abs_srcdir}/Makefile.custom
|
-include ${repmgr_abs_srcdir}/Makefile.custom
|
||||||
|
|
||||||
REPMGR_VERSION=$(shell awk '/^\#define REPMGR_VERSION / { print $3; }' ${repmgr_abs_srcdir}/repmgr_version.h.in | cut -d '"' -f 2)
|
REPMGR_VERSION=$(shell awk '/^\#define REPMGR_VERSION / { print $3; }' ${repmgr_abs_srcdir}/repmgr_version.h.in | cut -d '"' -f 2)
|
||||||
|
REPMGR_RELEASE_DATE=$(shell awk '/^\#define REPMGR_RELEASE_DATE / { print $3; }' ${repmgr_abs_srcdir}/repmgr_version.h.in | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
|||||||
@@ -502,10 +502,15 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
|
|||||||
else if (strcmp(name, "conninfo") == 0)
|
else if (strcmp(name, "conninfo") == 0)
|
||||||
strncpy(options->conninfo, value, MAXLEN);
|
strncpy(options->conninfo, value, MAXLEN);
|
||||||
else if (strcmp(name, "data_directory") == 0)
|
else if (strcmp(name, "data_directory") == 0)
|
||||||
|
{
|
||||||
strncpy(options->data_directory, value, MAXPGPATH);
|
strncpy(options->data_directory, value, MAXPGPATH);
|
||||||
|
canonicalize_path(options->data_directory);
|
||||||
|
}
|
||||||
else if (strcmp(name, "config_directory") == 0)
|
else if (strcmp(name, "config_directory") == 0)
|
||||||
|
{
|
||||||
strncpy(options->config_directory, value, MAXPGPATH);
|
strncpy(options->config_directory, value, MAXPGPATH);
|
||||||
|
canonicalize_path(options->config_directory);
|
||||||
|
}
|
||||||
else if (strcmp(name, "replication_user") == 0)
|
else if (strcmp(name, "replication_user") == 0)
|
||||||
{
|
{
|
||||||
if (strlen(value) < sizeof(options->replication_user))
|
if (strlen(value) < sizeof(options->replication_user))
|
||||||
|
|||||||
72
dbutils.c
72
dbutils.c
@@ -336,12 +336,10 @@ establish_db_connection_by_params(t_conninfo_param_list *param_list,
|
|||||||
bool
|
bool
|
||||||
is_superuser_connection(PGconn *conn, t_connection_user *userinfo)
|
is_superuser_connection(PGconn *conn, t_connection_user *userinfo)
|
||||||
{
|
{
|
||||||
char *current_user = NULL;
|
|
||||||
const char *superuser_status = NULL;
|
|
||||||
bool is_superuser = false;
|
bool is_superuser = false;
|
||||||
|
const char *current_user = PQuser(conn);
|
||||||
|
const char *superuser_status = PQparameterStatus(conn, "is_superuser");
|
||||||
|
|
||||||
current_user = PQuser(conn);
|
|
||||||
superuser_status = PQparameterStatus(conn, "is_superuser");
|
|
||||||
is_superuser = (strcmp(superuser_status, "on") == 0) ? true : false;
|
is_superuser = (strcmp(superuser_status, "on") == 0) ? true : false;
|
||||||
|
|
||||||
if (userinfo != NULL)
|
if (userinfo != NULL)
|
||||||
@@ -356,6 +354,51 @@ is_superuser_connection(PGconn *conn, t_connection_user *userinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
connection_has_pg_settings(PGconn *conn)
|
||||||
|
{
|
||||||
|
bool has_pg_settings = false;
|
||||||
|
|
||||||
|
/* superusers can always read pg_settings */
|
||||||
|
if (is_superuser_connection(conn, NULL) == true)
|
||||||
|
{
|
||||||
|
has_pg_settings = true;
|
||||||
|
}
|
||||||
|
/* from PostgreSQL 10, a non-superuser may have been granted access */
|
||||||
|
else if(PQserverVersion(conn) >= 100000)
|
||||||
|
{
|
||||||
|
PQExpBufferData query;
|
||||||
|
PGresult *res;
|
||||||
|
|
||||||
|
initPQExpBuffer(&query);
|
||||||
|
appendPQExpBufferStr(&query,
|
||||||
|
" SELECT CASE "
|
||||||
|
" WHEN pg_catalog.pg_has_role('pg_monitor','MEMBER') "
|
||||||
|
" THEN TRUE "
|
||||||
|
" WHEN pg_catalog.pg_has_role('pg_read_all_settings','MEMBER') "
|
||||||
|
" THEN TRUE "
|
||||||
|
" ELSE FALSE "
|
||||||
|
" END AS has_pg_settings");
|
||||||
|
|
||||||
|
res = PQexec(conn, query.data);
|
||||||
|
|
||||||
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
|
{
|
||||||
|
log_db_error(conn, query.data,
|
||||||
|
_("connection_has_pg_settings(): unable to query user roles"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
has_pg_settings = atobool(PQgetvalue(res, 0, 0));
|
||||||
|
}
|
||||||
|
termPQExpBuffer(&query);
|
||||||
|
PQclear(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_pg_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
close_connection(PGconn **conn)
|
close_connection(PGconn **conn)
|
||||||
{
|
{
|
||||||
@@ -1865,8 +1908,20 @@ repmgrd_set_pid(PGconn *conn, pid_t repmgrd_pid, const char *pidfile)
|
|||||||
initPQExpBuffer(&query);
|
initPQExpBuffer(&query);
|
||||||
|
|
||||||
appendPQExpBuffer(&query,
|
appendPQExpBuffer(&query,
|
||||||
"SELECT repmgr.set_repmgrd_pid(%i, '%s')",
|
"SELECT repmgr.set_repmgrd_pid(%i, ",
|
||||||
(int) repmgrd_pid, pidfile);
|
(int) repmgrd_pid);
|
||||||
|
|
||||||
|
if (pidfile != NULL)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(&query,
|
||||||
|
" '%s')",
|
||||||
|
pidfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appendPQExpBufferStr(&query,
|
||||||
|
" '')");
|
||||||
|
}
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
res = PQexec(conn, query.data);
|
||||||
termPQExpBuffer(&query);
|
termPQExpBuffer(&query);
|
||||||
@@ -2092,9 +2147,9 @@ get_repmgr_extension_status(PGconn *conn, t_extension_versions *extversions)
|
|||||||
appendPQExpBufferStr(&query,
|
appendPQExpBufferStr(&query,
|
||||||
" SELECT ae.name, e.extname, "
|
" SELECT ae.name, e.extname, "
|
||||||
" ae.default_version, "
|
" ae.default_version, "
|
||||||
" (((ae.default_version::NUMERIC::INT) * 10000) + (ae.default_version::NUMERIC - ae.default_version::NUMERIC::INT) * 1000)::INT AS available, "
|
" (((FLOOR(ae.default_version::NUMERIC)::INT) * 10000) + (ae.default_version::NUMERIC - FLOOR(ae.default_version::NUMERIC)::INT) * 1000)::INT AS available, "
|
||||||
" ae.installed_version, "
|
" ae.installed_version, "
|
||||||
" (((ae.installed_version::NUMERIC::INT) * 10000) + (ae.installed_version::NUMERIC - ae.installed_version::NUMERIC::INT) * 1000)::INT AS installed "
|
" (((FLOOR(ae.installed_version::NUMERIC)::INT) * 10000) + (ae.installed_version::NUMERIC - FLOOR(ae.installed_version::NUMERIC)::INT) * 1000)::INT AS installed "
|
||||||
" FROM pg_catalog.pg_available_extensions ae "
|
" FROM pg_catalog.pg_available_extensions ae "
|
||||||
"LEFT JOIN pg_catalog.pg_extension e "
|
"LEFT JOIN pg_catalog.pg_extension e "
|
||||||
" ON e.extname=ae.name "
|
" ON e.extname=ae.name "
|
||||||
@@ -5073,6 +5128,7 @@ init_replication_info(ReplInfo *replication_info)
|
|||||||
replication_info->receiving_streamed_wal = true;
|
replication_info->receiving_streamed_wal = true;
|
||||||
replication_info->wal_replay_paused = false;
|
replication_info->wal_replay_paused = false;
|
||||||
replication_info->upstream_last_seen = -1;
|
replication_info->upstream_last_seen = -1;
|
||||||
|
replication_info->upstream_node_id = UNKNOWN_NODE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ PGconn *get_primary_connection(PGconn *standby_conn, int *primary_id, char *p
|
|||||||
PGconn *get_primary_connection_quiet(PGconn *standby_conn, int *primary_id, char *primary_conninfo_out);
|
PGconn *get_primary_connection_quiet(PGconn *standby_conn, int *primary_id, char *primary_conninfo_out);
|
||||||
|
|
||||||
bool is_superuser_connection(PGconn *conn, t_connection_user *userinfo);
|
bool is_superuser_connection(PGconn *conn, t_connection_user *userinfo);
|
||||||
|
bool connection_has_pg_settings(PGconn *conn);
|
||||||
void close_connection(PGconn **conn);
|
void close_connection(PGconn **conn);
|
||||||
|
|
||||||
/* conninfo manipulation functions */
|
/* conninfo manipulation functions */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ ALLXML := $(wildcard $(srcdir)/*.xml) $(GENERATED_XML)
|
|||||||
version.xml: $(repmgr_top_builddir)/repmgr_version.h
|
version.xml: $(repmgr_top_builddir)/repmgr_version.h
|
||||||
{ \
|
{ \
|
||||||
echo "<!ENTITY repmgrversion \"$(REPMGR_VERSION)\">"; \
|
echo "<!ENTITY repmgrversion \"$(REPMGR_VERSION)\">"; \
|
||||||
|
echo "<!ENTITY releasedate \"$(REPMGR_RELEASE_DATE)\">"; \
|
||||||
} > $@
|
} > $@
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -16,8 +16,36 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect1 id="release-4.4">
|
<sect1 id="release-4.4">
|
||||||
<title>Release 4.4</title>
|
<title id="release-current">Release 4.4</title>
|
||||||
<para><emphasis>?? June, 2019</emphasis></para>
|
<para><emphasis>27 June, 2019</emphasis></para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
&repmgr; 4.4 is a major release.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
For details on how to upgrade an existing &repmgr; instrallation, see
|
||||||
|
documentation section <link linkend="upgrading-major-version">Upgrading a major version release</link>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
If &repmgrd; is in use, a PostgreSQL restart <emphasis>is</emphasis> required;
|
||||||
|
in that case we suggest combining this &repmgr; upgrade with the next PostgreSQL
|
||||||
|
minor release, which will require a PostgreSQL restart in any case.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<important>
|
||||||
|
<para>
|
||||||
|
On Debian-based systems, including Ubuntu, if using &repmgrd;
|
||||||
|
please ensure that in the file <filename>/etc/init.d/repmgrd</filename>, the parameter
|
||||||
|
<varname>REPMGRD_OPTS</varname> contains "<literal>--daemonize=false</literal>", e.g.:
|
||||||
|
<programlisting>
|
||||||
|
# additional options
|
||||||
|
REPMGRD_OPTS="--daemonize=false"</programlisting>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
For further details, see <link linkend="repmgrd-configuration-debian-ubuntu">repmgrd configuration on Debian/Ubuntu</link>.
|
||||||
|
</para>
|
||||||
|
</important>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>repmgr client enhancements</title>
|
<title>repmgr client enhancements</title>
|
||||||
@@ -43,6 +71,14 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<link linkend="repmgr-standby-follow"><command>repmgr standby follow</command></link>:
|
||||||
|
note that an active, reachable cluster primary is required for this command;
|
||||||
|
and provide a more helpful error message if no reachable primary could be found.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
&repmgr;: when executing <link linkend="repmgr-standby-switchover"><command>repmgr standby switchover</command></link>,
|
&repmgr;: when executing <link linkend="repmgr-standby-switchover"><command>repmgr standby switchover</command></link>,
|
||||||
@@ -75,7 +111,6 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<link linkend="repmgr-standby-promote"><command>repmgr standby promote</command></link>:
|
<link linkend="repmgr-standby-promote"><command>repmgr standby promote</command></link>:
|
||||||
@@ -163,7 +198,7 @@
|
|||||||
execute a custom script.
|
execute a custom script.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
This provided an additional method for fencing an isolated primary node, and/or taking
|
This provides an additional method for fencing an isolated primary node, and/or taking
|
||||||
other action if one or more standys become disconnected.
|
other action if one or more standys become disconnected.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@@ -221,6 +256,14 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
&repmgr;: when executing <link linkend="repmgr-standby-clone"><command>repmgr standby clone</command></link>
|
||||||
|
with the <option>--upstream-conninfo</option>, ensure that <varname>application_name</varname>
|
||||||
|
is set correctly in <varname>primary_conninfo</varname>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
&repmgr;: when executing <link linkend="repmgr-standby-switchover"><command>repmgr standby switchover</command></link>,
|
&repmgr;: when executing <link linkend="repmgr-standby-switchover"><command>repmgr standby switchover</command></link>,
|
||||||
@@ -229,6 +272,16 @@
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
&repmgr;: canonicalize the data directory path when parsing the configuration file, so
|
||||||
|
the provided path matches the path PostgreSQL reports as its data directory.
|
||||||
|
Otherwise, if e.g. the data directory is configured with a trailing slash,
|
||||||
|
<link linkend="repmgr-node-check"><command>repmgr node check --data-directory-config</command></link>
|
||||||
|
will return a spurious error.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
&repmgrd;: fix memory leak which occurs while the monitored PostgreSQL node is <emphasis>not</emphasis>
|
&repmgrd;: fix memory leak which occurs while the monitored PostgreSQL node is <emphasis>not</emphasis>
|
||||||
|
|||||||
@@ -52,6 +52,24 @@
|
|||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Currently &repmgr;'s support for cloning from Barman is implemented by using
|
||||||
|
<productname>rsync</productname> to clone from the Barman server.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
It is therefore not able to make use of Barman's parallel restore facility, which
|
||||||
|
is executed on the Barman server and clones to the target server.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Barman's parallel restore facility can be used by executing it manually on
|
||||||
|
the Barman server and integrating the resulting cloned standby using
|
||||||
|
<command><link linkend="repmgr-standby-clone">repmgr standby clone --recovery-conf-only</link></command>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="cloning-from-barman-prerequisites">
|
<sect2 id="cloning-from-barman-prerequisites">
|
||||||
<title>Prerequisites for cloning from Barman</title>
|
<title>Prerequisites for cloning from Barman</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -60,8 +78,7 @@
|
|||||||
<itemizedlist spacing="compact" mark="bullet">
|
<itemizedlist spacing="compact" mark="bullet">
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
the <varname>barman_server</varname> setting in <filename>repmgr.conf</filename> is the same as the
|
the Barman catalogue must include at least one valid backup for this server;
|
||||||
server configured in Barman;
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -72,19 +89,68 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
the <varname>restore_command</varname> setting in <filename>repmgr.conf</filename> is configured to
|
the <varname>barman_server</varname> setting in <filename>repmgr.conf</filename> is the same as the
|
||||||
use a copy of the <command>barman-wal-restore</command> script shipped with the
|
server configured in Barman.
|
||||||
<literal>barman-cli</literal> package (see section <xref linkend="cloning-from-barman-restore-command"/>
|
|
||||||
below).
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
the Barman catalogue includes at least one valid backup for this server.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
For example, assuming Barman is located on the host "<literal>barmansrv</literal>"
|
||||||
|
under the "<literal>barman</literal>" user account,
|
||||||
|
<filename>repmgr.conf</filename> should contain the following entries:
|
||||||
|
<programlisting>
|
||||||
|
barman_host=barman@barmansrv
|
||||||
|
barman_server=somedb</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
To use a non-default Barman configuration file on the Barman server,
|
||||||
|
specify this in <filename>repmgr.conf</filename> with <filename>barman_config</filename>:
|
||||||
|
<programlisting>
|
||||||
|
barman_config=/path/to/barman.conf</programlisting>
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
|
|
||||||
|
<para>
|
||||||
|
We also recommend configuring the <varname>restore_command</varname> setting in <filename>repmgr.conf</filename>
|
||||||
|
to use the <command>barman-wal-restore</command> script
|
||||||
|
(see section <xref linkend="cloning-from-barman-restore-command"/> below).
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<tip>
|
||||||
|
<simpara>
|
||||||
|
If you have a non-default SSH configuration on the Barman
|
||||||
|
server, e.g. using a port other than 22, then you can set those
|
||||||
|
parameters in a dedicated Host section in <filename>~/.ssh/config</filename>
|
||||||
|
corresponding to the value of <varname>barman_host</varname> in
|
||||||
|
<filename>repmgr.conf</filename>. See the <literal>Host</literal>
|
||||||
|
section in <command>man 5 ssh_config</command> for more details.
|
||||||
|
</simpara>
|
||||||
|
</tip>
|
||||||
|
<para>
|
||||||
|
It's now possible to clone a standby from Barman, e.g.:
|
||||||
|
<programlisting>
|
||||||
|
$ repmgr -f /etc/repmgr.conf -h node1 -U repmgr -d repmgr standby clone
|
||||||
|
NOTICE: destination directory "/var/lib/postgresql/data" provided
|
||||||
|
INFO: connecting to Barman server to verify backup for "test_cluster"
|
||||||
|
INFO: checking and correcting permissions on existing directory "/var/lib/postgresql/data"
|
||||||
|
INFO: creating directory "/var/lib/postgresql/data/repmgr"...
|
||||||
|
INFO: connecting to Barman server to fetch server parameters
|
||||||
|
INFO: connecting to source node
|
||||||
|
DETAIL: current installation size is 30 MB
|
||||||
|
NOTICE: retrieving backup from Barman...
|
||||||
|
(...)
|
||||||
|
NOTICE: standby clone (from Barman) complete
|
||||||
|
NOTICE: you can now start your PostgreSQL server
|
||||||
|
HINT: for example: pg_ctl -D /var/lib/postgresql/data start</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<simpara>
|
<simpara>
|
||||||
Barman support is automatically enabled if <varname>barman_server</varname>
|
Barman support is automatically enabled if <varname>barman_server</varname>
|
||||||
@@ -94,37 +160,7 @@
|
|||||||
command line option.
|
command line option.
|
||||||
</simpara>
|
</simpara>
|
||||||
</note>
|
</note>
|
||||||
<tip>
|
|
||||||
<simpara>
|
|
||||||
If you have a non-default SSH configuration on the Barman
|
|
||||||
server, e.g. using a port other than 22, then you can set those
|
|
||||||
parameters in a dedicated Host section in <filename>~/.ssh/config</filename>
|
|
||||||
corresponding to the value of<varname>barman_host</varname> in
|
|
||||||
<filename>repmgr.conf</filename>. See the <literal>Host</literal>
|
|
||||||
section in <command>man 5 ssh_config</command> for more details.
|
|
||||||
</simpara>
|
|
||||||
</tip>
|
|
||||||
<para>
|
|
||||||
It's now possible to clone a standby from Barman, e.g.:
|
|
||||||
<programlisting>
|
|
||||||
NOTICE: using configuration file "/etc/repmgr.conf"
|
|
||||||
NOTICE: destination directory "/var/lib/postgresql/data" provided
|
|
||||||
INFO: connecting to Barman server to verify backup for test_cluster
|
|
||||||
INFO: checking and correcting permissions on existing directory "/var/lib/postgresql/data"
|
|
||||||
INFO: creating directory "/var/lib/postgresql/data/repmgr"...
|
|
||||||
INFO: connecting to Barman server to fetch server parameters
|
|
||||||
INFO: connecting to upstream node
|
|
||||||
INFO: connected to source node, checking its state
|
|
||||||
INFO: successfully connected to source node
|
|
||||||
DETAIL: current installation size is 29 MB
|
|
||||||
NOTICE: retrieving backup from Barman...
|
|
||||||
receiving file list ...
|
|
||||||
(...)
|
|
||||||
NOTICE: standby clone (from Barman) complete
|
|
||||||
NOTICE: you can now start your PostgreSQL server
|
|
||||||
HINT: for example: pg_ctl -D /var/lib/postgresql/data start</programlisting>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="cloning-from-barman-restore-command" xreflabel="Using Barman as a WAL file source">
|
<sect2 id="cloning-from-barman-restore-command" xreflabel="Using Barman as a WAL file source">
|
||||||
<title>Using Barman as a WAL file source</title>
|
<title>Using Barman as a WAL file source</title>
|
||||||
@@ -142,35 +178,28 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<command>barman-wal-restore</command> is a Python script provided as part of the <literal>barman-cli</literal>
|
<command>barman-wal-restore</command> is a Python script provided as part of the <literal>barman-cli</literal>
|
||||||
package (Barman 2.0 and later; for Barman 1.x the script is provided separately as
|
package (Barman 2.0 ~ 2.7) or as part of the core Barman distribution (Barman 2.8 and later).
|
||||||
<command>barman-wal-restore.py</command>) which performs this function for Barman.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
To use <command>barman-wal-restore</command> with &repmgr;
|
To use <command>barman-wal-restore</command> with &repmgr;,
|
||||||
and assuming Barman is located on the <literal>barmansrv</literal> host
|
assuming Barman is located on the host "<literal>barmansrv</literal>"
|
||||||
|
under the "<literal>barman</literal>" user account,
|
||||||
and that <command>barman-wal-restore</command> is located as an executable at
|
and that <command>barman-wal-restore</command> is located as an executable at
|
||||||
<filename>/usr/bin/barman-wal-restore</filename>,
|
<filename>/usr/bin/barman-wal-restore</filename>,
|
||||||
<filename>repmgr.conf</filename> should include the following lines:
|
<filename>repmgr.conf</filename> should include the following lines:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
barman_host=barmansrv
|
barman_host=barman@barmansrv
|
||||||
barman_server=somedb
|
barman_server=somedb
|
||||||
restore_command=/usr/bin/barman-wal-restore barmansrv somedb %f %p</programlisting>
|
restore_command=/usr/bin/barman-wal-restore barmansrv somedb %f %p</programlisting>
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<simpara>
|
<simpara>
|
||||||
<command>barman-wal-restore</command> supports command line switches to
|
<command>barman-wal-restore</command> supports command line switches to
|
||||||
control parallelism (<literal>--parallel=N</literal>) and compression (
|
control parallelism (<literal>--parallel=N</literal>) and compression
|
||||||
<literal>--bzip2</literal>, <literal>--gzip</literal>).
|
(<literal>--bzip2</literal>, <literal>--gzip</literal>).
|
||||||
</simpara>
|
</simpara>
|
||||||
</note>
|
</note>
|
||||||
<note>
|
|
||||||
<para>
|
|
||||||
To use a non-default Barman configuration file on the Barman server,
|
|
||||||
specify this in <filename>repmgr.conf</filename> with <filename>barman_config</filename>:
|
|
||||||
<programlisting>
|
|
||||||
barman_config=/path/to/barman.conf</programlisting>
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
|||||||
124
doc/configuration-file-optional-settings.xml
Normal file
124
doc/configuration-file-optional-settings.xml
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<sect1 id="configuration-file-optional-settings" xreflabel="optional configuration file settings">
|
||||||
|
|
||||||
|
<title>Optional configuration file settings</title>
|
||||||
|
|
||||||
|
<indexterm>
|
||||||
|
<primary>repmgr.conf</primary>
|
||||||
|
<secondary>optional settings</secondary>
|
||||||
|
</indexterm>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
<varlistentry id="repmgr-conf-config-directory" xreflabel="config_directory">
|
||||||
|
<term><varname>config_directory</varname> (<type>string</type>)
|
||||||
|
<indexterm>
|
||||||
|
<primary><varname>config_directory</varname> configuration file parameter</primary>
|
||||||
|
</indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
If PostgreSQL configuration files are located outside the data
|
||||||
|
directory, specify the directory where the main
|
||||||
|
<filename>postgresql.conf</filename> file is located.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
This enables explicit provision of an external configuration file
|
||||||
|
directory, which if set will be passed to <command>pg_ctl</command> as the
|
||||||
|
<option>-D</option> parameter. Otherwise <command>pg_ctl</command> will
|
||||||
|
default to using the data directory, which will cause some operations
|
||||||
|
to fail if the configuration files are not present there.
|
||||||
|
</para>
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
This is implemented primarily for feature completeness and for
|
||||||
|
development/testing purposes. Users who have installed &repmgr; from
|
||||||
|
a package should <emphasis>not</emphasis> rely on to stop/start/restart PostgreSQL,
|
||||||
|
instead they should set the appropriate <option>service_..._command</option>
|
||||||
|
for their operating system. For more details see
|
||||||
|
<xref linkend="configuration-file-service-commands"/>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry id="repmgr-conf-replication-user" xreflabel="replication_user">
|
||||||
|
<term><varname>replication_user</varname> (<type>string</type>)
|
||||||
|
<indexterm>
|
||||||
|
<primary><varname>replication_user</varname> configuration file parameter</primary>
|
||||||
|
</indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
PostgreSQL user to make replication connections with.
|
||||||
|
If not set defaults, to the user defined in <xref linkend="repmgr-conf-conninfo"/>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<varlistentry id="repmgr-conf-replication-type" xreflabel="replication_type">
|
||||||
|
<term><varname>replication_type</varname> (<type>string</type>)
|
||||||
|
<indexterm>
|
||||||
|
<primary><varname>replication_type</varname> configuration file parameter</primary>
|
||||||
|
</indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Must be one of <literal>physical</literal> (for standard streaming replication)
|
||||||
|
or <literal>bdr</literal>.
|
||||||
|
</para>
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Replication type <literal>bdr</literal> can only be used with BDR 2.x
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
BDR 3.x users should use <literal>physical</literal>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry id="repmgr-conf-location" xreflabel="location">
|
||||||
|
<term><varname>location</varname> (<type>string</type>)
|
||||||
|
<indexterm>
|
||||||
|
<primary><varname>location</varname> configuration file parameter</primary>
|
||||||
|
</indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
An arbitrary string defining the location of the node; this
|
||||||
|
is used during failover to check visibility of the
|
||||||
|
current primary node.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
For more details see <xref linkend="repmgrd-network-split"/>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry id="repmgr-conf-use-replication-slots" xreflabel="use_replication_slots">
|
||||||
|
<term><varname>use_replication_slots</varname> (<type>boolean</type>)
|
||||||
|
<indexterm>
|
||||||
|
<primary><varname>use_replication_slots</varname> configuration file parameter</primary>
|
||||||
|
</indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Whether to use physical replication slots.
|
||||||
|
</para>
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
When using replication slots,
|
||||||
|
<varname>max_replication_slots</varname> should be configured for
|
||||||
|
at least the number of standbys which will connect
|
||||||
|
to the primary.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
|
</variablelist>
|
||||||
|
</sect1>
|
||||||
@@ -96,33 +96,6 @@
|
|||||||
</variablelist>
|
</variablelist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
For a full list of annotated configuration items, see the file
|
|
||||||
<ulink url="https://raw.githubusercontent.com/2ndQuadrant/repmgr/master/repmgr.conf.sample">repmgr.conf.sample</ulink>.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
For &repmgrd;-specific settings, see <xref linkend="repmgrd-configuration"/>.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>
|
|
||||||
The following parameters in the configuration file can be overridden with
|
|
||||||
command line options:
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
<simpara>
|
|
||||||
<literal>-L/--log-level</literal> overrides <literal>log_level</literal> in
|
|
||||||
<filename>repmgr.conf</filename>
|
|
||||||
</simpara>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<simpara>
|
|
||||||
<literal>-b/--pg_bindir</literal> overrides <literal>pg_bindir</literal> in
|
|
||||||
<filename>repmgr.conf</filename>
|
|
||||||
</simpara>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|||||||
@@ -62,6 +62,70 @@ data_directory = /var/lib/pgsql/11/data</programlisting>
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|
||||||
|
<sect2 id="configuration-file-items" xreflabel="configuration file items">
|
||||||
|
|
||||||
|
<title>Configuration file items</title>
|
||||||
|
<para>
|
||||||
|
The following sections document some sections of the configuration file:
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<xref linkend="configuration-file-settings"/>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<xref linkend="configuration-file-optional-settings"/>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<xref linkend="configuration-file-log-settings"/>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<xref linkend="configuration-file-service-commands"/>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
|
</itemizedlist>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
For a full list of annotated configuration items, see the file
|
||||||
|
<ulink url="https://raw.githubusercontent.com/2ndQuadrant/repmgr/master/repmgr.conf.sample">repmgr.conf.sample</ulink>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
For &repmgrd;-specific settings, see <xref linkend="repmgrd-configuration"/>.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
The following parameters in the configuration file can be overridden with
|
||||||
|
command line options:
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<literal>-L/--log-level</literal> overrides <literal>log_level</literal> in
|
||||||
|
<filename>repmgr.conf</filename>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<simpara>
|
||||||
|
<literal>-b/--pg_bindir</literal> overrides <literal>pg_bindir</literal> in
|
||||||
|
<filename>repmgr.conf</filename>
|
||||||
|
</simpara>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="configuration-file-location" xreflabel="configuration file location">
|
<sect2 id="configuration-file-location" xreflabel="configuration file location">
|
||||||
<title>Configuration file location</title>
|
<title>Configuration file location</title>
|
||||||
|
|||||||
@@ -305,6 +305,7 @@
|
|||||||
|
|
||||||
&configuration-file;
|
&configuration-file;
|
||||||
&configuration-file-required-settings;
|
&configuration-file-required-settings;
|
||||||
|
&configuration-file-optional-settings;
|
||||||
&configuration-file-log-settings;
|
&configuration-file-log-settings;
|
||||||
&configuration-file-service-commands;
|
&configuration-file-service-commands;
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<!ENTITY configuration SYSTEM "configuration.xml">
|
<!ENTITY configuration SYSTEM "configuration.xml">
|
||||||
<!ENTITY configuration-file SYSTEM "configuration-file.xml">
|
<!ENTITY configuration-file SYSTEM "configuration-file.xml">
|
||||||
<!ENTITY configuration-file-required-settings SYSTEM "configuration-file-required-settings.xml">
|
<!ENTITY configuration-file-required-settings SYSTEM "configuration-file-required-settings.xml">
|
||||||
|
<!ENTITY configuration-file-optional-settings SYSTEM "configuration-file-optional-settings.xml">
|
||||||
<!ENTITY configuration-file-log-settings SYSTEM "configuration-file-log-settings.xml">
|
<!ENTITY configuration-file-log-settings SYSTEM "configuration-file-log-settings.xml">
|
||||||
<!ENTITY configuration-file-service-commands SYSTEM "configuration-file-service-commands.xml">
|
<!ENTITY configuration-file-service-commands SYSTEM "configuration-file-service-commands.xml">
|
||||||
<!ENTITY cloning-standbys SYSTEM "cloning-standbys.xml">
|
<!ENTITY cloning-standbys SYSTEM "cloning-standbys.xml">
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
&repmgr; 4.x is compatible with all PostgreSQL versions from 9.3. See
|
&repmgr; &repmgrversion; is compatible with all PostgreSQL versions from 9.3. See
|
||||||
section <link linkend="install-compatibility-matrix">&repmgr; compatibility matrix</link>
|
section <link linkend="install-compatibility-matrix">&repmgr; compatibility matrix</link>
|
||||||
for an overview of version compatibility.
|
for an overview of version compatibility.
|
||||||
</para>
|
</para>
|
||||||
@@ -39,13 +39,13 @@
|
|||||||
|
|
||||||
<note>
|
<note>
|
||||||
<simpara>
|
<simpara>
|
||||||
The same "major" &repmgr; version (e.g. <literal>4.2.x</literal>) <emphasis>must</emphasis>
|
The same "major" &repmgr; version (e.g. <literal>&repmgrversion;.x</literal>) <emphasis>must</emphasis>
|
||||||
be installed on all node in the replication cluster. We strongly recommend keeping all
|
be installed on all node in the replication cluster. We strongly recommend keeping all
|
||||||
nodes on the same (preferably latest) "minor" &repmgr; version to minimize the risk
|
nodes on the same (preferably latest) "minor" &repmgr; version to minimize the risk
|
||||||
of incompatibilities.
|
of incompatibilities.
|
||||||
</simpara>
|
</simpara>
|
||||||
<simpara>
|
<simpara>
|
||||||
If different "major" &repmgr; versions (e.g. 3.3.x and 4.1.x)
|
If different "major" &repmgr; versions (e.g. 4.1.x and &repmgrversion;.x)
|
||||||
are installed on different nodes, in the best case &repmgr; (in particular &repmgrd;)
|
are installed on different nodes, in the best case &repmgr; (in particular &repmgrd;)
|
||||||
will not run. In the worst case, you will end up with a broken cluster.
|
will not run. In the worst case, you will end up with a broken cluster.
|
||||||
</simpara>
|
</simpara>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
&repmgr; 4.x
|
&repmgr; 4.x
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<link linkend="release-4.2">4.2</link> (2018-10-24)
|
<link linkend="release-current">&repmgrversion;</link> (&releasedate;)
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
9.3, 9.4, 9.5, 9.6, 10, 11
|
9.3, 9.4, 9.5, 9.6, 10, 11
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Note that some &repmgr; functionality is not available in PostgreSQL 9.3 and PostgreSQL 9.4.
|
Note that some &repmgr; functionality is not available in PostgreSQL 9.3 and PostgreSQL 9.4:
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist spacing="compact" mark="bullet">
|
<itemizedlist spacing="compact" mark="bullet">
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
$ repmgr -f /etc/repmgr.conf cluster show
|
$ repmgr -f /etc/repmgr.conf cluster show
|
||||||
|
|
||||||
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
|
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
|
||||||
----+-------+---------+-----------+----------+----------+----------+-----------------------------------------
|
----+-------+---------+-----------+----------+----------+----------+----------+-----------------------------------------
|
||||||
1 | node1 | primary | * running | | default | 100 | 1 | host=db_node1 dbname=repmgr user=repmgr
|
1 | node1 | primary | * running | | default | 100 | 1 | host=db_node1 dbname=repmgr user=repmgr
|
||||||
2 | node2 | standby | running | node1 | default | 100 | 1 | host=db_node2 dbname=repmgr user=repmgr
|
2 | node2 | standby | running | node1 | default | 100 | 1 | host=db_node2 dbname=repmgr user=repmgr
|
||||||
3 | node3 | standby | running | node1 | default | 100 | 1 | host=db_node3 dbname=repmgr user=repmgr</programlisting>
|
3 | node3 | standby | running | node1 | default | 100 | 1 | host=db_node3 dbname=repmgr user=repmgr</programlisting>
|
||||||
@@ -82,12 +82,12 @@
|
|||||||
(but <literal>node3</literal> is not attached to it, and its metadata has not yet been updated);
|
(but <literal>node3</literal> is not attached to it, and its metadata has not yet been updated);
|
||||||
<literal>node4</literal> is running but rejecting connections (from <literal>node3</literal> at least).
|
<literal>node4</literal> is running but rejecting connections (from <literal>node3</literal> at least).
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ID | Name | Role | Status | Upstream | Location | Priority | Connection string
|
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
|
||||||
----+-------+---------+----------------------+----------+----------+----------+-----------------------------------------
|
----+-------+---------+----------------------+----------+----------+----------+----------+-----------------------------------------
|
||||||
1 | node1 | primary | ? unreachable | | default | 100 | host=db_node1 dbname=repmgr user=repmgr
|
1 | node1 | primary | ? unreachable | | default | 100 | 1 | host=db_node1 dbname=repmgr user=repmgr
|
||||||
2 | node2 | standby | ! running as primary | node1 | default | 100 | host=db_node2 dbname=repmgr user=repmgr
|
2 | node2 | standby | ! running as primary | node1 | default | 100 | 2 | host=db_node2 dbname=repmgr user=repmgr
|
||||||
3 | node3 | standby | running | node1 | default | 100 | host=db_node3 dbname=repmgr user=repmgr
|
3 | node3 | standby | running | node1 | default | 100 | 1 | host=db_node3 dbname=repmgr user=repmgr
|
||||||
4 | node4 | standby | ? running | node1 | default | 100 | host=db_node4 dbname=repmgr user=repmgr
|
4 | node4 | standby | ? running | node1 | default | 100 | ? | host=db_node4 dbname=repmgr user=repmgr
|
||||||
|
|
||||||
WARNING: following issues were detected
|
WARNING: following issues were detected
|
||||||
- unable to connect to node "node1" (ID: 1)
|
- unable to connect to node "node1" (ID: 1)
|
||||||
|
|||||||
@@ -202,6 +202,18 @@
|
|||||||
ensure the <filename>repmgr.conf</filename>
|
ensure the <filename>repmgr.conf</filename>
|
||||||
file is created for the node, and that it has been registered using
|
file is created for the node, and that it has been registered using
|
||||||
<command><link linkend="repmgr-standby-register">repmgr standby register</link></command>.
|
<command><link linkend="repmgr-standby-register">repmgr standby register</link></command>.
|
||||||
|
</para>
|
||||||
|
<tip>
|
||||||
|
<para>
|
||||||
|
To register a standby which is not running, execute
|
||||||
|
<link linkend="repmgr-standby-register">repmgr standby register --force</link>
|
||||||
|
and provide the connection details for the primary.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
See <xref linkend="repmgr-standby-register-inactive-node"/> for more details.
|
||||||
|
</para>
|
||||||
|
</tip>
|
||||||
|
<para>
|
||||||
Then execute the command <command>repmgr standby clone --recovery-conf-only</command>.
|
Then execute the command <command>repmgr standby clone --recovery-conf-only</command>.
|
||||||
This will create the <filename>recovery.conf</filename> file needed to attach
|
This will create the <filename>recovery.conf</filename> file needed to attach
|
||||||
the node to its upstream, and will also create a replication slot on the
|
the node to its upstream, and will also create a replication slot on the
|
||||||
@@ -326,9 +338,13 @@
|
|||||||
<term><option>--upstream-conninfo</option></term>
|
<term><option>--upstream-conninfo</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<literal>primary_conninfo</literal> value to write in recovery.conf
|
<literal>primary_conninfo</literal> value to write in <filename>recovery.conf</filename>
|
||||||
when the intended upstream server does not yet exist.
|
when the intended upstream server does not yet exist.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
Note that &repmgr; may modify the provided value, in particular to set the
|
||||||
|
correct <literal>application_name</literal>.
|
||||||
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -20,22 +20,17 @@
|
|||||||
("follow target"). Typically this will be the primary, but this
|
("follow target"). Typically this will be the primary, but this
|
||||||
command can also be used to attach the standby to another standby.
|
command can also be used to attach the standby to another standby.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This command requires a valid
|
This command requires a valid <filename>repmgr.conf</filename> file for the standby,
|
||||||
<filename>repmgr.conf</filename> file for the standby, either specified
|
either specified explicitly with <literal>-f/--config-file</literal> or located in a
|
||||||
explicitly with <literal>-f/--config-file</literal> or located in a
|
|
||||||
default location; no additional arguments are required.
|
default location; no additional arguments are required.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>The standby node ("follow candidate") <emphasis>must</emphasis>
|
||||||
By default &repmgr; will attempt to attach the standby to the current primary.
|
be running. If the new upstream ("follow target") is not the primary,
|
||||||
If <option>--upstream-node-id</option> is provided, &repmgr; will attempt
|
the cluster primary <emphasis>must</emphasis> be running and accessible from the
|
||||||
to attach the standby to the specified node, which can be another standby.
|
standby node.
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
This command will force a restart of the standby server, which must be
|
|
||||||
running.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<tip>
|
<tip>
|
||||||
@@ -45,6 +40,16 @@
|
|||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
By default &repmgr; will attempt to attach the standby to the current primary.
|
||||||
|
If <option>--upstream-node-id</option> is provided, &repmgr; will attempt
|
||||||
|
to attach the standby to the specified node, which can be another standby.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This command will force a restart of PostgreSQL on the standby node.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<command>repmgr standby follow</command> will wait up to
|
<command>repmgr standby follow</command> will wait up to
|
||||||
<varname>standby_follow_timeout</varname> seconds (default: <literal>30</literal>)
|
<varname>standby_follow_timeout</varname> seconds (default: <literal>30</literal>)
|
||||||
@@ -166,7 +171,7 @@
|
|||||||
be possible to follow the new upstream node, and &repmgr; will emit an error
|
be possible to follow the new upstream node, and &repmgr; will emit an error
|
||||||
message like this:
|
message like this:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ERROR: this node cannot attach to follow target node 3
|
ERROR: this node cannot attach to follow target node "node3" (ID 3)
|
||||||
DETAIL: follow target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/6108880</programlisting>
|
DETAIL: follow target server's timeline 2 forked off current database system timeline 1 before current recovery point 0/6108880</programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -75,10 +75,22 @@
|
|||||||
<para>
|
<para>
|
||||||
Under some circumstances you may wish to register a standby which is not
|
Under some circumstances you may wish to register a standby which is not
|
||||||
yet running; this can be the case when using provisioning tools to create
|
yet running; this can be the case when using provisioning tools to create
|
||||||
a complex replication cluster. In this case, by using the <option>-F/--force</option>
|
a complex replication cluster, or if the node was not cloned by &repmgr;.
|
||||||
option and providing the connection parameters to the primary server,
|
|
||||||
the standby can be registered.
|
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
In this case, by using the <option>-F/--force</option>
|
||||||
|
option and providing the connection parameters to the primary server,
|
||||||
|
the standby can be registered even if it has not yet been started.
|
||||||
|
</para>
|
||||||
|
<tip>
|
||||||
|
<para>
|
||||||
|
Connection parameters can either be provided either as a <literal>conninfo</literal> string
|
||||||
|
(e.g. <option>-d 'host=node1 user=repmgr'</option> or as individual connection parameters
|
||||||
|
(<option>-h/--host</option>, <option>-d/--dbname</option>,
|
||||||
|
<option>-U/--user</option>, <option>-p/--port</option> etc.).
|
||||||
|
</para>
|
||||||
|
</tip>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Similarly, with cascading replication it may be necessary to register
|
Similarly, with cascading replication it may be necessary to register
|
||||||
a standby whose upstream node has not yet been registered - in this case,
|
a standby whose upstream node has not yet been registered - in this case,
|
||||||
@@ -96,9 +108,10 @@
|
|||||||
<title>Registering a node not cloned by repmgr</title>
|
<title>Registering a node not cloned by repmgr</title>
|
||||||
<para>
|
<para>
|
||||||
If you've cloned a standby using another method (e.g. <application>barman</application>'s
|
If you've cloned a standby using another method (e.g. <application>barman</application>'s
|
||||||
<command>barman recover</command> command), first execute
|
<command>barman recover</command> command), register the node as detailed in section
|
||||||
|
<xref linkend="repmgr-standby-register-inactive-node"/> then execute
|
||||||
<link linkend="repmgr-standby-create-recovery-conf">repmgr standby clone --recovery-conf-only</link>
|
<link linkend="repmgr-standby-create-recovery-conf">repmgr standby clone --recovery-conf-only</link>
|
||||||
to add the <filename>recovery.conf</filename> file, then register the standby as usual.
|
to generate the appropriate replication configuration.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
@@ -119,7 +132,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-F</option><option>--force</option></term>
|
<term><option>-F</option>/<option>--force</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Overwrite an existing node record
|
Overwrite an existing node record
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<para>
|
<para>
|
||||||
For more complex replication scenarios,e.g. with multiple datacentres, it may
|
For more complex replication scenarios, e.g. with multiple datacentres, it may
|
||||||
be preferable to use location-based failover, which ensures that only nodes
|
be preferable to use location-based failover, which ensures that only nodes
|
||||||
in the same location as the primary will ever be promotion candidates;
|
in the same location as the primary will ever be promotion candidates;
|
||||||
see <xref linkend="repmgrd-network-split"/> for more details.
|
see <xref linkend="repmgrd-network-split"/> for more details.
|
||||||
|
|||||||
@@ -15,9 +15,13 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
&repmgrd; can be configured to provide failover
|
&repmgrd; can be configured to provide failover
|
||||||
capability in case the primary upstream node becomes unreachable, and/or
|
capability in case the primary or upstream node becomes unreachable, and/or
|
||||||
provide monitoring data to the &repmgr; metadatabase.
|
provide monitoring data to the &repmgr; metadatabase.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
From &repmgr; 4.4, when running on the primary node, &repmgrd; can also monitor
|
||||||
|
standby disconnections/reconnections (see <xref linkend="repmgrd-primary-child-disconnection"/>).
|
||||||
|
</para>
|
||||||
|
|
||||||
<sect1 id="repmgrd-basic-configuration">
|
<sect1 id="repmgrd-basic-configuration">
|
||||||
<title>repmgrd configuration</title>
|
<title>repmgrd configuration</title>
|
||||||
@@ -222,6 +226,17 @@
|
|||||||
Normally <option>promote_command</option> is set as &repmgr;'s
|
Normally <option>promote_command</option> is set as &repmgr;'s
|
||||||
<command><link linkend="repmgr-standby-promote">repmgr standby promote</link></command> command.
|
<command><link linkend="repmgr-standby-promote">repmgr standby promote</link></command> command.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
When invoking <command>repmgr standby promote</command> (either directly via
|
||||||
|
the <option>promote_command</option>, or in a script called
|
||||||
|
via <option>promote_command</option>), <option>--siblings-follow</option>
|
||||||
|
<emphasis>must not</emphasis> be included as a
|
||||||
|
command line option for <command>repmgr standby promote</command>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
It is also possible to provide a shell script to e.g. perform user-defined tasks
|
It is also possible to provide a shell script to e.g. perform user-defined tasks
|
||||||
before promoting the current node. In this case the script <emphasis>must</emphasis>
|
before promoting the current node. In this case the script <emphasis>must</emphasis>
|
||||||
@@ -554,7 +569,8 @@ repmgrd_service_stop_command='sudo systemctl repmgr11 stop'
|
|||||||
the option <option>monitor_interval_secs</option> (see above).
|
the option <option>monitor_interval_secs</option> (see above).
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
For more details on monitoring, see <xref linkend="repmgrd-monitoring"/>.
|
For more details on monitoring, see <xref linkend="repmgrd-monitoring"/>. For information on
|
||||||
|
monitoring standby disconnections, see <xref linkend="repmgrd-primary-child-disconnection"/>.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If &repmgrd; is in use, it's worth double-checking that
|
If &repmgrd; is in use, it's worth double-checking that
|
||||||
all nodes are unpaused by executing <command><link linkend="repmgr-daemon-status">repmgr-daemon-status</link></command>.
|
all nodes are unpaused by executing <command><link linkend="repmgr-daemon-status">repmgr daemon status</link></command>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ ALTER EXTENSION repmgr UPDATE</programlisting>
|
|||||||
<tip>
|
<tip>
|
||||||
<para>
|
<para>
|
||||||
Use <command><link linkend="repmgr-node-check">repmgr node check</link></command>
|
Use <command><link linkend="repmgr-node-check">repmgr node check</link></command>
|
||||||
to determine which replacation slots need to be recreated.
|
to determine which replication slots need to be recreated.
|
||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ CREATE VIEW repmgr.show_nodes AS
|
|||||||
LEFT JOIN repmgr.nodes un
|
LEFT JOIN repmgr.nodes un
|
||||||
ON un.node_id = n.upstream_node_id;
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
/* XXX update upgrade scripts! */
|
|
||||||
CREATE TABLE repmgr.voting_term (
|
CREATE TABLE repmgr.voting_term (
|
||||||
term INT NOT NULL
|
term INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ CREATE VIEW repmgr.show_nodes AS
|
|||||||
LEFT JOIN repmgr.nodes un
|
LEFT JOIN repmgr.nodes un
|
||||||
ON un.node_id = n.upstream_node_id;
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
/* XXX update upgrade scripts! */
|
|
||||||
CREATE TABLE repmgr.voting_term (
|
CREATE TABLE repmgr.voting_term (
|
||||||
term INT NOT NULL
|
term INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ CREATE VIEW repmgr.show_nodes AS
|
|||||||
LEFT JOIN repmgr.nodes un
|
LEFT JOIN repmgr.nodes un
|
||||||
ON un.node_id = n.upstream_node_id;
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
/* XXX update upgrade scripts! */
|
|
||||||
CREATE TABLE repmgr.voting_term (
|
CREATE TABLE repmgr.voting_term (
|
||||||
term INT NOT NULL
|
term INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ CREATE VIEW repmgr.show_nodes AS
|
|||||||
LEFT JOIN repmgr.nodes un
|
LEFT JOIN repmgr.nodes un
|
||||||
ON un.node_id = n.upstream_node_id;
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
/* XXX update upgrade scripts! */
|
|
||||||
CREATE TABLE repmgr.voting_term (
|
CREATE TABLE repmgr.voting_term (
|
||||||
term INT NOT NULL
|
term INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ CREATE VIEW repmgr.show_nodes AS
|
|||||||
LEFT JOIN repmgr.nodes un
|
LEFT JOIN repmgr.nodes un
|
||||||
ON un.node_id = n.upstream_node_id;
|
ON un.node_id = n.upstream_node_id;
|
||||||
|
|
||||||
|
|
||||||
/* XXX update upgrade scripts! */
|
|
||||||
CREATE TABLE repmgr.voting_term (
|
CREATE TABLE repmgr.voting_term (
|
||||||
term INT NOT NULL
|
term INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1833,7 +1833,7 @@ do_node_check_data_directory(PGconn *conn, OutputMode mode, t_node_info *node_in
|
|||||||
* a superuser connection
|
* a superuser connection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (is_superuser_connection(conn, NULL) == true)
|
if (connection_has_pg_settings(conn) == true)
|
||||||
{
|
{
|
||||||
/* we expect to have a database connection */
|
/* we expect to have a database connection */
|
||||||
if (get_pg_setting(conn, "data_directory", actual_data_directory) == false)
|
if (get_pg_setting(conn, "data_directory", actual_data_directory) == false)
|
||||||
@@ -1878,7 +1878,7 @@ do_node_check_data_directory(PGconn *conn, OutputMode mode, t_node_info *node_in
|
|||||||
/* XXX add -S/--superuser option */
|
/* XXX add -S/--superuser option */
|
||||||
if (PQserverVersion(conn) >= 100000)
|
if (PQserverVersion(conn) >= 100000)
|
||||||
{
|
{
|
||||||
log_hint(_("add the \"%s\" user to group \"pg_read_all_settings\""),
|
log_hint(_("add the \"%s\" user to group \"pg_read_all_settings\" or \"pg_monitor\""),
|
||||||
PQuser(conn));
|
PQuser(conn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ static void get_barman_property(char *dst, char *name, char *local_repmgr_direct
|
|||||||
static int get_tablespace_data_barman(char *, TablespaceDataList *);
|
static int get_tablespace_data_barman(char *, TablespaceDataList *);
|
||||||
static char *make_barman_ssh_command(char *buf);
|
static char *make_barman_ssh_command(char *buf);
|
||||||
|
|
||||||
static bool create_recovery_file(t_node_info *node_record, t_conninfo_param_list *recovery_conninfo, char *dest, bool as_file);
|
static bool create_recovery_file(t_node_info *node_record, t_conninfo_param_list *primary_conninfo, char *dest, bool as_file);
|
||||||
static void write_primary_conninfo(PQExpBufferData *dest, t_conninfo_param_list *param_list);
|
static void write_primary_conninfo(PQExpBufferData *dest, t_conninfo_param_list *param_list);
|
||||||
static bool check_sibling_nodes(NodeInfoList *sibling_nodes, SiblingNodeStats *sibling_nodes_stats);
|
static bool check_sibling_nodes(NodeInfoList *sibling_nodes, SiblingNodeStats *sibling_nodes_stats);
|
||||||
static bool check_free_wal_senders(int available_wal_senders, SiblingNodeStats *sibling_nodes_stats, bool *dry_run_success);
|
static bool check_free_wal_senders(int available_wal_senders, SiblingNodeStats *sibling_nodes_stats, bool *dry_run_success);
|
||||||
@@ -1000,6 +1000,9 @@ _do_create_recovery_conf(void)
|
|||||||
/* check connection */
|
/* check connection */
|
||||||
source_conn = establish_db_connection_by_params(&source_conninfo, true);
|
source_conn = establish_db_connection_by_params(&source_conninfo, true);
|
||||||
|
|
||||||
|
/* Verify that source is a supported server version */
|
||||||
|
(void) check_server_version(source_conn, "source node", true, NULL);
|
||||||
|
|
||||||
/* determine node for primary_conninfo */
|
/* determine node for primary_conninfo */
|
||||||
|
|
||||||
if (runtime_options.upstream_node_id != UNKNOWN_NODE_ID)
|
if (runtime_options.upstream_node_id != UNKNOWN_NODE_ID)
|
||||||
@@ -2784,12 +2787,6 @@ do_standby_follow(void)
|
|||||||
|
|
||||||
PQfinish(local_conn);
|
PQfinish(local_conn);
|
||||||
|
|
||||||
if (runtime_options.dry_run == true)
|
|
||||||
{
|
|
||||||
log_info(_("prerequisites for executing STANDBY FOLLOW are met"));
|
|
||||||
exit(SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we'll need a connection to the primary, if the upstream is not a primary.
|
* Here we'll need a connection to the primary, if the upstream is not a primary.
|
||||||
*/
|
*/
|
||||||
@@ -2802,12 +2799,30 @@ do_standby_follow(void)
|
|||||||
primary_conn = get_primary_connection_quiet(follow_target_conn,
|
primary_conn = get_primary_connection_quiet(follow_target_conn,
|
||||||
&primary_node_id,
|
&primary_node_id,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If follow target is not primary and no other primary could be found,
|
||||||
|
* abort because we won't be able to update the node record.
|
||||||
|
*/
|
||||||
|
if (PQstatus(primary_conn) != CONNECTION_OK)
|
||||||
|
{
|
||||||
|
log_error(_("unable to determine the cluster primary"));
|
||||||
|
log_detail(_("an active primary node is required for \"repmgr standby follow\""));
|
||||||
|
PQfinish(follow_target_conn);
|
||||||
|
exit(ERR_FOLLOW_FAIL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
primary_conn = follow_target_conn;
|
primary_conn = follow_target_conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runtime_options.dry_run == true)
|
||||||
|
{
|
||||||
|
log_info(_("prerequisites for executing STANDBY FOLLOW are met"));
|
||||||
|
exit(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
initPQExpBuffer(&follow_output);
|
initPQExpBuffer(&follow_output);
|
||||||
|
|
||||||
success = do_standby_follow_internal(
|
success = do_standby_follow_internal(
|
||||||
@@ -2991,42 +3006,9 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise connection parameters to write as `primary_conninfo` */
|
|
||||||
initialize_conninfo_params(&recovery_conninfo, false);
|
|
||||||
|
|
||||||
/* We ignore any application_name set in the primary's conninfo */
|
|
||||||
parse_conninfo_string(follow_target_node_record->conninfo, &recovery_conninfo, &errmsg, true);
|
|
||||||
|
|
||||||
{
|
|
||||||
t_conninfo_param_list local_node_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER;
|
|
||||||
bool parse_success;
|
|
||||||
|
|
||||||
initialize_conninfo_params(&local_node_conninfo, false);
|
|
||||||
|
|
||||||
parse_success = parse_conninfo_string(local_node_record.conninfo, &local_node_conninfo, &errmsg, false);
|
|
||||||
|
|
||||||
if (parse_success == false)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* this shouldn't happen, but if it does we'll plough on
|
* Store the original upstream node id so we can delete the
|
||||||
* regardless
|
* replication slot, if it exists.
|
||||||
*/
|
|
||||||
log_warning(_("unable to parse conninfo string \"%s\":\n %s"),
|
|
||||||
local_node_record.conninfo, errmsg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *application_name = param_get(&local_node_conninfo, "application_name");
|
|
||||||
|
|
||||||
if (application_name != NULL && strlen(application_name))
|
|
||||||
param_set(&recovery_conninfo, "application_name", application_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
free_conninfo_params(&local_node_conninfo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* store the original upstream node id so we can delete the
|
|
||||||
* replication slot, if exists
|
|
||||||
*/
|
*/
|
||||||
if (local_node_record.upstream_node_id != UNKNOWN_NODE_ID)
|
if (local_node_record.upstream_node_id != UNKNOWN_NODE_ID)
|
||||||
{
|
{
|
||||||
@@ -3037,8 +3019,14 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
original_upstream_node_id = follow_target_node_record->node_id;
|
original_upstream_node_id = follow_target_node_record->node_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config_file_options.use_replication_slots && runtime_options.host_param_provided == false)
|
||||||
if (config_file_options.use_replication_slots && runtime_options.host_param_provided == false && original_upstream_node_id != UNKNOWN_NODE_ID)
|
{
|
||||||
|
/*
|
||||||
|
* Only attempt to delete the old replication slot if the old upstream
|
||||||
|
* node is known and is different to the follow target node.
|
||||||
|
*/
|
||||||
|
if (original_upstream_node_id != UNKNOWN_NODE_ID
|
||||||
|
&& original_upstream_node_id != follow_target_node_record->node_id)
|
||||||
{
|
{
|
||||||
remove_old_replication_slot = true;
|
remove_old_replication_slot = true;
|
||||||
}
|
}
|
||||||
@@ -3066,6 +3054,12 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialise connection parameters to write as "primary_conninfo" */
|
||||||
|
initialize_conninfo_params(&recovery_conninfo, false);
|
||||||
|
|
||||||
|
/* We ignore any application_name set in the primary's conninfo */
|
||||||
|
parse_conninfo_string(follow_target_node_record->conninfo, &recovery_conninfo, &errmsg, true);
|
||||||
|
|
||||||
/* Set the application name to this node's name */
|
/* Set the application name to this node's name */
|
||||||
param_set(&recovery_conninfo, "application_name", config_file_options.node_name);
|
param_set(&recovery_conninfo, "application_name", config_file_options.node_name);
|
||||||
|
|
||||||
@@ -3187,8 +3181,6 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
* Note that if this function is called by do_standby_switchover(), the
|
* Note that if this function is called by do_standby_switchover(), the
|
||||||
* "repmgr node rejoin" command executed on the demotion candidate may already
|
* "repmgr node rejoin" command executed on the demotion candidate may already
|
||||||
* have removed the slot, so there may be nothing to do.
|
* have removed the slot, so there may be nothing to do.
|
||||||
*
|
|
||||||
* XXX check if former upstream is current primary?
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (remove_old_replication_slot == true)
|
if (remove_old_replication_slot == true)
|
||||||
@@ -4769,6 +4761,7 @@ check_source_server()
|
|||||||
t_node_info upstream_node_record = T_NODE_INFO_INITIALIZER;
|
t_node_info upstream_node_record = T_NODE_INFO_INITIALIZER;
|
||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
ExtensionStatus extension_status = REPMGR_UNKNOWN;
|
ExtensionStatus extension_status = REPMGR_UNKNOWN;
|
||||||
|
t_extension_versions extversions = T_EXTENSION_VERSIONS_INITIALIZER;
|
||||||
|
|
||||||
/* Attempt to connect to the upstream server to verify its configuration */
|
/* Attempt to connect to the upstream server to verify its configuration */
|
||||||
log_verbose(LOG_DEBUG, "check_source_server()");
|
log_verbose(LOG_DEBUG, "check_source_server()");
|
||||||
@@ -4832,7 +4825,7 @@ check_source_server()
|
|||||||
* to be used as a standalone clone tool)
|
* to be used as a standalone clone tool)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extension_status = get_repmgr_extension_status(primary_conn, NULL);
|
extension_status = get_repmgr_extension_status(primary_conn, &extversions);
|
||||||
|
|
||||||
if (extension_status != REPMGR_INSTALLED)
|
if (extension_status != REPMGR_INSTALLED)
|
||||||
{
|
{
|
||||||
@@ -4847,20 +4840,25 @@ check_source_server()
|
|||||||
exit(ERR_DB_QUERY);
|
exit(ERR_DB_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* schema doesn't exist */
|
|
||||||
log_error(_("repmgr extension not found on source node"));
|
|
||||||
|
|
||||||
if (extension_status == REPMGR_AVAILABLE)
|
if (extension_status == REPMGR_AVAILABLE)
|
||||||
{
|
{
|
||||||
log_detail(_("repmgr extension is available but not installed in database \"%s\""),
|
log_error(_("repmgr extension is available but not installed in database \"%s\""),
|
||||||
param_get(&source_conninfo, "dbname"));
|
param_get(&source_conninfo, "dbname"));
|
||||||
|
log_hint(_("check that you are cloning from the database where \"repmgr\" is installed"));
|
||||||
}
|
}
|
||||||
else if (extension_status == REPMGR_UNAVAILABLE)
|
else if (extension_status == REPMGR_UNAVAILABLE)
|
||||||
{
|
{
|
||||||
log_detail(_("repmgr extension is not available on the upstream node"));
|
log_error(_("repmgr extension is not available on the upstream node"));
|
||||||
|
}
|
||||||
|
else if (extension_status == REPMGR_OLD_VERSION_INSTALLED)
|
||||||
|
{
|
||||||
|
log_error(_("an older version of the extension is installed on the upstream node"));
|
||||||
|
log_detail(_("version %s is installed but newer version %s is available"),
|
||||||
|
extversions.installed_version,
|
||||||
|
extversions.default_version);
|
||||||
|
log_hint(_("upgrade \"repmgr\" on the source node first"));
|
||||||
}
|
}
|
||||||
|
|
||||||
log_hint(_("check that the upstream node is part of a repmgr cluster"));
|
|
||||||
PQfinish(source_conn);
|
PQfinish(source_conn);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
@@ -4885,6 +4883,13 @@ check_source_server()
|
|||||||
* later, as this is a precautionary check and we can retrieve the system
|
* later, as this is a precautionary check and we can retrieve the system
|
||||||
* identifier with a normal connection.
|
* identifier with a normal connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (runtime_options.dry_run == true)
|
||||||
|
{
|
||||||
|
log_info(_("\"repmgr\" extension is installed in database \"%s\""),
|
||||||
|
param_get(&source_conninfo, "dbname"));
|
||||||
|
}
|
||||||
|
|
||||||
if (get_recovery_type(source_conn) == RECTYPE_PRIMARY && PQserverVersion(source_conn) >= 90600)
|
if (get_recovery_type(source_conn) == RECTYPE_PRIMARY && PQserverVersion(source_conn) >= 90600)
|
||||||
{
|
{
|
||||||
uint64 source_system_identifier = system_identifier(source_conn);
|
uint64 source_system_identifier = system_identifier(source_conn);
|
||||||
@@ -6942,11 +6947,11 @@ check_recovery_type(PGconn *conn)
|
|||||||
* Creates a recovery.conf file for a standby
|
* Creates a recovery.conf file for a standby
|
||||||
*
|
*
|
||||||
* A database connection pointer is required for escaping primary_conninfo
|
* A database connection pointer is required for escaping primary_conninfo
|
||||||
* parameters. When cloning from Barman and --no-upstream-connection ) this
|
* parameters. When cloning from Barman and --no-upstream-connection supplied,
|
||||||
* might not be available.
|
* this might not be available.
|
||||||
*/
|
*/
|
||||||
bool
|
static bool
|
||||||
create_recovery_file(t_node_info *node_record, t_conninfo_param_list *recovery_conninfo, char *dest, bool as_file)
|
create_recovery_file(t_node_info *node_record, t_conninfo_param_list *primary_conninfo, char *dest, bool as_file)
|
||||||
{
|
{
|
||||||
PQExpBufferData recovery_file_buf;
|
PQExpBufferData recovery_file_buf;
|
||||||
char recovery_file_path[MAXPGPATH] = "";
|
char recovery_file_path[MAXPGPATH] = "";
|
||||||
@@ -6961,29 +6966,7 @@ create_recovery_file(t_node_info *node_record, t_conninfo_param_list *recovery_c
|
|||||||
"standby_mode = 'on'\n");
|
"standby_mode = 'on'\n");
|
||||||
|
|
||||||
/* primary_conninfo = '...' */
|
/* primary_conninfo = '...' */
|
||||||
|
write_primary_conninfo(&recovery_file_buf, primary_conninfo);
|
||||||
/*
|
|
||||||
* the user specified --upstream-conninfo string - copy that
|
|
||||||
*/
|
|
||||||
if (strlen(runtime_options.upstream_conninfo))
|
|
||||||
{
|
|
||||||
char *escaped = escape_recovery_conf_value(runtime_options.upstream_conninfo);
|
|
||||||
|
|
||||||
appendPQExpBuffer(&recovery_file_buf,
|
|
||||||
"primary_conninfo = '%s'\n",
|
|
||||||
escaped);
|
|
||||||
|
|
||||||
free(escaped);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* otherwise use the conninfo inferred from the upstream connection and/or
|
|
||||||
* node record
|
|
||||||
*/
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write_primary_conninfo(&recovery_file_buf, recovery_conninfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* recovery_target_timeline = 'latest' */
|
/* recovery_target_timeline = 'latest' */
|
||||||
appendPQExpBufferStr(&recovery_file_buf,
|
appendPQExpBufferStr(&recovery_file_buf,
|
||||||
|
|||||||
@@ -1908,6 +1908,7 @@ check_cli_parameters(const int action)
|
|||||||
case NODE_SERVICE:
|
case NODE_SERVICE:
|
||||||
case DAEMON_PAUSE:
|
case DAEMON_PAUSE:
|
||||||
case DAEMON_UNPAUSE:
|
case DAEMON_UNPAUSE:
|
||||||
|
case DAEMON_STATUS:
|
||||||
case DAEMON_START:
|
case DAEMON_START:
|
||||||
case DAEMON_STOP:
|
case DAEMON_STOP:
|
||||||
break;
|
break;
|
||||||
@@ -2833,15 +2834,25 @@ create_repmgr_extension(PGconn *conn)
|
|||||||
int
|
int
|
||||||
check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string)
|
check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string)
|
||||||
{
|
{
|
||||||
int conn_server_version_num = get_server_version(conn, server_version_string);
|
char version_string[MAXVERSIONSTR] = "";
|
||||||
|
int conn_server_version_num = get_server_version(conn, version_string);
|
||||||
|
|
||||||
|
/* Copy the version string, if the caller wants it */
|
||||||
|
if (server_version_string != NULL)
|
||||||
|
strncpy(server_version_string, version_string, MAXVERSIONSTR);
|
||||||
|
|
||||||
if (conn_server_version_num < MIN_SUPPORTED_VERSION_NUM)
|
if (conn_server_version_num < MIN_SUPPORTED_VERSION_NUM)
|
||||||
{
|
{
|
||||||
if (conn_server_version_num > 0)
|
if (conn_server_version_num > 0)
|
||||||
|
{
|
||||||
log_error(_("%s requires %s to be PostgreSQL %s or later"),
|
log_error(_("%s requires %s to be PostgreSQL %s or later"),
|
||||||
progname(),
|
progname(),
|
||||||
server_type,
|
server_type,
|
||||||
MIN_SUPPORTED_VERSION);
|
MIN_SUPPORTED_VERSION);
|
||||||
|
log_detail(_("%s server version is %s"),
|
||||||
|
server_type,
|
||||||
|
version_string);
|
||||||
|
}
|
||||||
|
|
||||||
if (exit_on_error == true)
|
if (exit_on_error == true)
|
||||||
{
|
{
|
||||||
@@ -2852,6 +2863,38 @@ check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *
|
|||||||
return UNKNOWN_SERVER_VERSION_NUM;
|
return UNKNOWN_SERVER_VERSION_NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If it's clear a particular repmgr feature branch won't be able to support
|
||||||
|
* PostgreSQL from a particular PostgreSQL release onwards (e.g. 4.4 with PostgreSQL
|
||||||
|
* 12 and later due to recovery.conf removal), set MAX_UNSUPPORTED_VERSION and
|
||||||
|
* MAX_UNSUPPORTED_VERSION_NUM in "repmgr.h" to define the first PostgreSQL
|
||||||
|
* version which can't be suppored.
|
||||||
|
*/
|
||||||
|
#ifdef MAX_UNSUPPORTED_VERSION_NUM
|
||||||
|
if (conn_server_version_num >= MAX_UNSUPPORTED_VERSION_NUM)
|
||||||
|
{
|
||||||
|
if (conn_server_version_num > 0)
|
||||||
|
{
|
||||||
|
log_error(_("%s %s does not support PostgreSQL %s or later"),
|
||||||
|
progname(),
|
||||||
|
REPMGR_VERSION,
|
||||||
|
MAX_UNSUPPORTED_VERSION);
|
||||||
|
log_detail(_("%s server version is %s"),
|
||||||
|
server_type,
|
||||||
|
version_string);
|
||||||
|
log_hint(_("For details of supported versions see: https://repmgr.org/docs/current/install-requirements.html#INSTALL-COMPATIBILITY-MATRIX"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exit_on_error == true)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNKNOWN_SERVER_VERSION_NUM;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return conn_server_version_num;
|
return conn_server_version_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3029,18 +3072,18 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
|
|
||||||
if (*config_file_options.rsync_options == '\0')
|
if (*config_file_options.rsync_options == '\0')
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
"--archive --checksum --compress --progress --rsh=ssh");
|
"--archive --checksum --compress --progress --rsh=ssh");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
config_file_options.rsync_options);
|
config_file_options.rsync_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runtime_options.force)
|
if (runtime_options.force)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --delete --checksum");
|
" --delete --checksum");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3067,10 +3110,10 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
if (is_directory)
|
if (is_directory)
|
||||||
{
|
{
|
||||||
/* Files which we don't want */
|
/* Files which we don't want */
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=postmaster.pid --exclude=postmaster.opts --exclude=global/pg_control");
|
" --exclude=postmaster.pid --exclude=postmaster.opts --exclude=global/pg_control");
|
||||||
|
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=recovery.conf --exclude=recovery.done");
|
" --exclude=recovery.conf --exclude=recovery.done");
|
||||||
|
|
||||||
if (server_version_num >= 90400)
|
if (server_version_num >= 90400)
|
||||||
@@ -3079,7 +3122,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
* Ideally we'd use PG_AUTOCONF_FILENAME from utils/guc.h, but
|
* Ideally we'd use PG_AUTOCONF_FILENAME from utils/guc.h, but
|
||||||
* that has too many dependencies for a mere client program.
|
* that has too many dependencies for a mere client program.
|
||||||
*/
|
*/
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=postgresql.auto.conf.tmp");
|
" --exclude=postgresql.auto.conf.tmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3091,16 +3134,16 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
|
|
||||||
if (server_version_num >= 100000)
|
if (server_version_num >= 100000)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=pg_wal/*");
|
" --exclude=pg_wal/*");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=pg_xlog/*");
|
" --exclude=pg_xlog/*");
|
||||||
}
|
}
|
||||||
|
|
||||||
appendPQExpBuffer(&rsync_flags, "%s",
|
appendPQExpBufferStr(&rsync_flags,
|
||||||
" --exclude=pg_log/* --exclude=pg_stat_tmp/*");
|
" --exclude=pg_log/* --exclude=pg_stat_tmp/*");
|
||||||
|
|
||||||
maxlen_snprintf(script, "rsync %s %s:%s/* %s",
|
maxlen_snprintf(script, "rsync %s %s:%s/* %s",
|
||||||
|
|||||||
2
repmgr.c
2
repmgr.c
@@ -702,7 +702,7 @@ set_repmgrd_pid(PG_FUNCTION_ARGS)
|
|||||||
shared_state->repmgrd_pid = repmgrd_pid;
|
shared_state->repmgrd_pid = repmgrd_pid;
|
||||||
memset(shared_state->repmgrd_pidfile, 0, MAXPGPATH);
|
memset(shared_state->repmgrd_pidfile, 0, MAXPGPATH);
|
||||||
|
|
||||||
if(repmgrd_pidfile != NULL)
|
if (repmgrd_pidfile != NULL)
|
||||||
{
|
{
|
||||||
strncpy(shared_state->repmgrd_pidfile, repmgrd_pidfile, MAXPGPATH);
|
strncpy(shared_state->repmgrd_pidfile, repmgrd_pidfile, MAXPGPATH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# Optional configuration items
|
# Optional configuration items
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
@@ -68,16 +67,16 @@
|
|||||||
# Replication settings
|
# Replication settings
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
#replication_user='repmgr' # User to make replication connections with, if not set defaults
|
#replication_user='repmgr' # User to make replication connections with, if not set
|
||||||
# to the user defined in "conninfo".
|
# defaults to the user defined in "conninfo".
|
||||||
|
|
||||||
#replication_type=physical # Must be one of 'physical' or 'bdr'.
|
#replication_type=physical # Must be one of "physical" or "bdr".
|
||||||
# NOTE: "bdr" can only be used with BDR 2.x
|
# NOTE: "bdr" can only be used with BDR 2.x
|
||||||
|
|
||||||
#location=default # arbitrary string defining the location of the node; this
|
#location=default # An arbitrary string defining the location of the node; this
|
||||||
# is used during failover to check visibilty of the
|
# is used during failover to check visibility of the
|
||||||
# current primary node. See the 'repmgrd' documentation
|
# current primary node. For further details see:
|
||||||
# in README.md for further details.
|
# https://repmgr.org/docs/current/repmgrd-network-split.html
|
||||||
|
|
||||||
#use_replication_slots=no # whether to use physical replication slots
|
#use_replication_slots=no # whether to use physical replication slots
|
||||||
# NOTE: when using replication slots,
|
# NOTE: when using replication slots,
|
||||||
|
|||||||
34
repmgr.h
34
repmgr.h
@@ -21,6 +21,37 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef vsnprintf
|
||||||
|
#undef vsnprintf
|
||||||
|
#endif
|
||||||
|
#ifdef snprintf
|
||||||
|
#undef snprintf
|
||||||
|
#endif
|
||||||
|
#ifdef vsprintf
|
||||||
|
#undef vsprintf
|
||||||
|
#endif
|
||||||
|
#ifdef sprintf
|
||||||
|
#undef sprintf
|
||||||
|
#endif
|
||||||
|
#ifdef vfprintf
|
||||||
|
#undef vfprintf
|
||||||
|
#endif
|
||||||
|
#ifdef fprintf
|
||||||
|
#undef fprintf
|
||||||
|
#endif
|
||||||
|
#ifdef vprintf
|
||||||
|
#undef vprintf
|
||||||
|
#endif
|
||||||
|
#ifdef printf
|
||||||
|
#undef printf
|
||||||
|
#endif
|
||||||
|
#ifdef strerror
|
||||||
|
#undef strerror
|
||||||
|
#endif
|
||||||
|
#ifdef strerror_r
|
||||||
|
#undef strerror_r
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _REPMGR_H_
|
#ifndef _REPMGR_H_
|
||||||
#define _REPMGR_H_
|
#define _REPMGR_H_
|
||||||
|
|
||||||
@@ -46,6 +77,9 @@
|
|||||||
#define MIN_SUPPORTED_VERSION "9.3"
|
#define MIN_SUPPORTED_VERSION "9.3"
|
||||||
#define MIN_SUPPORTED_VERSION_NUM 90300
|
#define MIN_SUPPORTED_VERSION_NUM 90300
|
||||||
|
|
||||||
|
#define MAX_UNSUPPORTED_VERSION "12"
|
||||||
|
#define MAX_UNSUPPORTED_VERSION_NUM 120000
|
||||||
|
|
||||||
#define REPLICATION_TYPE_PHYSICAL 1
|
#define REPLICATION_TYPE_PHYSICAL 1
|
||||||
#define REPLICATION_TYPE_BDR 2
|
#define REPLICATION_TYPE_BDR 2
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
#define REPMGR_VERSION_DATE ""
|
#define REPMGR_VERSION_DATE ""
|
||||||
#define REPMGR_VERSION "4.4dev"
|
#define REPMGR_VERSION "4.4"
|
||||||
#define REPMGR_VERSION_NUM 40400
|
#define REPMGR_VERSION_NUM 40400
|
||||||
|
#define REPMGR_RELEASE_DATE "2019-06-27"
|
||||||
|
|||||||
@@ -4909,7 +4909,8 @@ check_node_can_follow(PGconn *local_conn, XLogRecPtr local_xlogpos, PGconn *foll
|
|||||||
*/
|
*/
|
||||||
if (local_xlogpos > follow_target_history->end)
|
if (local_xlogpos > follow_target_history->end)
|
||||||
{
|
{
|
||||||
log_error(_("this node cannot attach to follow target node %i"),
|
log_error(_("this node cannot attach to follow target node \"%s\" (ID: %i)"),
|
||||||
|
follow_target_node_info->node_name,
|
||||||
follow_target_node_info->node_id);
|
follow_target_node_info->node_id);
|
||||||
can_follow = false;
|
can_follow = false;
|
||||||
|
|
||||||
@@ -4921,8 +4922,10 @@ check_node_can_follow(PGconn *local_conn, XLogRecPtr local_xlogpos, PGconn *foll
|
|||||||
|
|
||||||
if (can_follow == true)
|
if (can_follow == true)
|
||||||
{
|
{
|
||||||
log_info(_("local node %i can attach to follow target node %i"),
|
log_info(_("local node \"%s\" (ID: %i) can attach to follow target node \"%s\" (ID: %i)"),
|
||||||
|
config_file_options.node_name,
|
||||||
config_file_options.node_id,
|
config_file_options.node_id,
|
||||||
|
follow_target_node_info->node_name,
|
||||||
follow_target_node_info->node_id);
|
follow_target_node_info->node_id);
|
||||||
|
|
||||||
log_detail(_("local node's recovery point: %X/%X; follow target node's fork point: %X/%X"),
|
log_detail(_("local node's recovery point: %X/%X; follow target node's fork point: %X/%X"),
|
||||||
|
|||||||
Reference in New Issue
Block a user