Home Explore Blog CI



postgresql

6th chunk of `doc/src/sgml/ref/pg_basebackup.sgml`
22b53c9fce685af0c384bba1e0c1ee0473b1f250f65b535f0000000100000fa3
 during
        the backup. Unless the method <literal>none</literal> is specified,
        it is possible to start a postmaster in the target
        directory without the need to consult the WAL archive, thus
        making the output a completely standalone backup.
       </para>
       <para>
        The following <replaceable>method</replaceable>s for collecting the
        write-ahead logs are supported:

        <variablelist>
         <varlistentry>
          <term><literal>n</literal></term>
          <term><literal>none</literal></term>
          <listitem>
           <para>
            Don't include write-ahead logs in the backup.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>f</literal></term>
          <term><literal>fetch</literal></term>
          <listitem>
           <para>
            The write-ahead log files are collected at the end of the backup.
            Therefore, it is necessary for the source server's
            <xref linkend="guc-wal-keep-size"/> parameter to be set high
            enough that the required log data is not removed before the end
            of the backup.  If the required log data has been recycled
            before it's time to transfer it, the backup will fail and be
            unusable.
           </para>
           <para>
            When tar format is used, the write-ahead log files will be
            included in the <filename>base.tar</filename> file.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry>
          <term><literal>s</literal></term>
          <term><literal>stream</literal></term>
          <listitem>
           <para>
            Stream write-ahead log data while the backup is being taken.
            This method will open a second connection to the server and
            start streaming the write-ahead log in parallel while running
            the backup.  Therefore, it will require two replication
            connections not just one.  As long as the client can keep up
            with the write-ahead log data, using this method requires no
            extra write-ahead logs to be saved on the source server.
           </para>
           <para>
            When tar format is used, the write-ahead log files will be
            written to a separate file named <filename>pg_wal.tar</filename>
            (if the server is a version earlier than 10, the file will be named
            <filename>pg_xlog.tar</filename>).
           </para>
           <para>
            This value is the default.
           </para>
          </listitem>
         </varlistentry>
        </variablelist></para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-z</option></term>
      <term><option>--gzip</option></term>
      <listitem>
       <para>
        Enables gzip compression of tar file output, with the default
        compression level. Compression is only available when using
        the tar format, and the suffix <filename>.gz</filename> will
        automatically be added to all tar filenames.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-Z <replaceable class="parameter">level</replaceable></option></term>
      <term><option>-Z [{client|server}-]<replaceable class="parameter">method</replaceable>[:<replaceable>detail</replaceable>]</option></term>
      <term><option>--compress=<replaceable class="parameter">level</replaceable></option></term>
      <term><option>--compress=[{client|server}-]<replaceable class="parameter">method</replaceable>[:<replaceable>detail</replaceable>]</option></term>
      <listitem>
       <para>
        Requests compression of the backup. If <literal>client</literal> or
        <literal>server</literal> is included, it specifies where the
        compression is to be performed. Compressing on the server will reduce
        transfer bandwidth but will increase

Title: pg_basebackup: WAL Methods and Compression Options
Summary
This section details the different methods for including WAL (write-ahead log) files in a `pg_basebackup`. The available methods are 'none' (exclude WAL), 'fetch' (collect WAL at the end of the backup, requiring sufficient `wal_keep_size`), and 'stream' (stream WAL during the backup, requiring two replication connections). The section also describes options for gzip compression of tar file output using `-z` and more advanced compression methods using `-Z` or `--compress`.