Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/ref/pg_receivewal.sgml`
dd5c509f57141e7f9420b71b41c1ff1270816cb3c2d8003c0000000100000d92
 name specified in
        <option>--slot</option>, then exit.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--drop-slot</option></term>
      <listitem>
       <para>
        Drop the replication slot with the name specified in
        <option>--slot</option>, then exit.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>

   <para>
    Other options are also available:

    <variablelist>
     <varlistentry>
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
       <para>
       Print the <application>pg_receivewal</application> version and exit.
       </para>
       </listitem>
     </varlistentry>

     <varlistentry>
       <term><option>-?</option></term>
       <term><option>--help</option></term>
       <listitem>
       <para>
       Show help about <application>pg_receivewal</application> command line
       arguments, and exit.
       </para>
       </listitem>
     </varlistentry>

    </variablelist>
   </para>

 </refsect1>

 <refsect1>
  <title>Exit Status</title>

  <para>
   <application>pg_receivewal</application> will exit with status 0 when
   terminated by the <systemitem>SIGINT</systemitem> or
   <systemitem>SIGTERM</systemitem> signal.  (That is the
   normal way to end it.  Hence it is not an error.)  For fatal errors or
   other signals, the exit status will be nonzero.
  </para>

 </refsect1>

 <refsect1>
  <title>Environment</title>

  <para>
   This utility, like most other <productname>PostgreSQL</productname> utilities,
   uses the environment variables supported by <application>libpq</application>
   (see <xref linkend="libpq-envars"/>).
  </para>

  <para>
   The environment variable <envar>PG_COLOR</envar> specifies whether to use
   color in diagnostic messages. Possible values are
   <literal>always</literal>, <literal>auto</literal> and
   <literal>never</literal>.
  </para>
 </refsect1>

 <refsect1>
  <title>Notes</title>

  <para>
   When using <application>pg_receivewal</application> instead of
   <xref linkend="guc-archive-command"/> or
   <xref linkend="guc-archive-library"/> as the main WAL backup method, it is
   strongly recommended to use replication slots.  Otherwise, the server is
   free to recycle or remove write-ahead log files before they are backed up,
   because it does not have any information, either
   from <xref linkend="guc-archive-command"/> or
   <xref linkend="guc-archive-library"/> or the replication slots, about
   how far the WAL stream has been archived.  Note, however, that a
   replication slot will fill up the server's disk space if the receiver does
   not keep up with fetching the WAL data.
  </para>

  <para>
   <application>pg_receivewal</application> will preserve group permissions on
   the received WAL files if group permissions are enabled on the source
   cluster.
  </para>

 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To stream the write-ahead log from the server at
   <literal>mydbserver</literal> and store it in the local directory
   <filename>/usr/local/pgsql/archive</filename>:
<screen>
<prompt>$</prompt> <userinput>pg_receivewal -h mydbserver -D /usr/local/pgsql/archive</userinput>
</screen></para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="app-pgbasebackup"/></member>
  </simplelist>
 </refsect1>

</refentry>

Title: pg_receivewal: Other Options, Exit Status, Environment, Notes, and Examples
Summary
This section covers the remaining command-line options for pg_receivewal, including displaying the version and help information. It then explains the exit status of the program, the environment variables it uses (through libpq), and notes on using pg_receivewal with replication slots for reliable WAL backups. It also provides a basic example of streaming WAL from a server to a local directory.