Commit 0c2c81b4 authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Add replication parameter to libpq documentation

Author: Michael Paquier <michael@paquier.xyz>
Reported-by: default avatarŞahap Aşçı <sahapasci@gmail.com>
Reviewed-by: default avatarVik Fearing <vik.fearing@2ndquadrant.com>
parent 8aa75e13
...@@ -1262,6 +1262,64 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname ...@@ -1262,6 +1262,64 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="libpq-connect-replication" xreflabel="replication">
<term><literal>replication</literal></term>
<listitem>
<para>
This option determines whether the connection should use the
replication protocol instead of the normal protocol. This is what
PostgreSQL replication connections as well as tools such as
<application>pg_basebackup</application> use internally, but it can
also be used by third-party applications. For a description of the
replication protocol, consult <xref linkend="protocol-replication"/>.
</para>
<para>
The following values, which are case-insensitive, are supported:
<variablelist>
<varlistentry>
<term>
<literal>true</literal>, <literal>on</literal>,
<literal>yes</literal>, <literal>1</literal>
</term>
<listitem>
<para>
The connection goes into physical replication mode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>database</literal></term>
<listitem>
<para>
The connection goes into logical replication mode, connecting to
the database specified in the <literal>dbname</literal> parameter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>false</literal>, <literal>off</literal>,
<literal>no</literal>, <literal>0</literal>
</term>
<listitem>
<para>
The connection is a regular one, which is the default behavior.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
In physical or logical replication mode, only the simple query protocol
can be used.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-connect-sslmode" xreflabel="sslmode"> <varlistentry id="libpq-connect-sslmode" xreflabel="sslmode">
<term><literal>sslmode</literal></term> <term><literal>sslmode</literal></term>
<listitem> <listitem>
......
...@@ -1635,16 +1635,27 @@ that cannot support <literal>tls-unique</literal> for some reason. ...@@ -1635,16 +1635,27 @@ that cannot support <literal>tls-unique</literal> for some reason.
<para> <para>
To initiate streaming replication, the frontend sends the To initiate streaming replication, the frontend sends the
<literal>replication</literal> parameter in the startup message. A Boolean value <literal>replication</literal> parameter in the startup message. A Boolean
of <literal>true</literal> tells the backend to go into walsender mode, wherein a value of <literal>true</literal> (or <literal>on</literal>,
small set of replication commands can be issued instead of SQL statements. Only <literal>yes</literal>, <literal>1</literal>) tells the backend to go into
the simple query protocol can be used in walsender mode. physical replication walsender mode, wherein a small set of replication
Replication commands are logged in the server log when commands, shown below, can be issued instead of SQL statements.
<xref linkend="guc-log-replication-commands"/> is enabled. </para>
Passing <literal>database</literal> as the value instructs walsender to connect to
the database specified in the <literal>dbname</literal> parameter, which will allow <para>
the connection to be used for logical replication from that database. Passing <literal>database</literal> as the value for the
<literal>replication</literal> parameter instructs the backend to go into
logical replication walsender mode, connecting to the database specified in
the <literal>dbname</literal> parameter. In logical replication walsender
mode, the replication commands shown below as well as normal SQL commands can
be issued.
</para>
<para>
In either physical replication or logical replication walsender mode, only the
simple query protocol can be used.
</para> </para>
<para> <para>
For the purpose of testing replication commands, you can make a replication For the purpose of testing replication commands, you can make a replication
connection via <application>psql</application> or any other <literal>libpq</literal>-using connection via <application>psql</application> or any other <literal>libpq</literal>-using
...@@ -1659,7 +1670,12 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" ...@@ -1659,7 +1670,12 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
</para> </para>
<para> <para>
The commands accepted in walsender mode are: Replication commands are logged in the server log when
<xref linkend="guc-log-replication-commands"/> is enabled.
</para>
<para>
The commands accepted in replication mode are:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><literal>IDENTIFY_SYSTEM</literal> <term><literal>IDENTIFY_SYSTEM</literal>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment