Home Explore Blog CI



postgresql

68th chunk of `doc/src/sgml/config.sgml`
7a6f6a36bd907ec4f369087027fd35985fb83fa734c3339a0000000100000fb6
 parameter</primary>
       </indexterm>
       </term>
       <listitem>
       <para>
        Specifies the maximum number of concurrent connections from standby
        servers or streaming base backup clients (i.e., the maximum number of
        simultaneously running WAL sender processes). The default is
        <literal>10</literal>.  The value <literal>0</literal> means
        replication is disabled.  Abrupt disconnection of a streaming client might
        leave an orphaned connection slot behind until a timeout is reached,
        so this parameter should be set slightly higher than the maximum
        number of expected clients so disconnected clients can immediately
        reconnect.  This parameter can only be set at server start.  Also,
        <varname>wal_level</varname> must be set to
        <literal>replica</literal> or higher to allow connections from standby
        servers.
       </para>

       <para>
         When running a standby server, you must set this parameter to the
         same or higher value than on the primary server. Otherwise, queries
         will not be allowed in the standby server.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry id="guc-max-replication-slots" xreflabel="max_replication_slots">
       <term><varname>max_replication_slots</varname> (<type>integer</type>)
       <indexterm>
        <primary><varname>max_replication_slots</varname> configuration parameter</primary>
       </indexterm>
       </term>
       <listitem>
        <para>
         Specifies the maximum number of replication slots
         (see <xref linkend="streaming-replication-slots"/>) that the server
         can support. The default is 10.  This parameter can only be set at
         server start.
         Setting it to a lower value than the number of currently
         existing replication slots will prevent the server from starting.
         Also, <varname>wal_level</varname> must be set
         to <literal>replica</literal> or higher to allow replication slots to
         be used.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry id="guc-wal-keep-size" xreflabel="wal_keep_size">
       <term><varname>wal_keep_size</varname> (<type>integer</type>)
       <indexterm>
        <primary><varname>wal_keep_size</varname> configuration parameter</primary>
       </indexterm>
       </term>
       <listitem>
       <para>
        Specifies the minimum size of past WAL files kept in the
        <filename>pg_wal</filename>
        directory, in case a standby server needs to fetch them for streaming
        replication. If a standby
        server connected to the sending server falls behind by more than
        <varname>wal_keep_size</varname> megabytes, the sending server might
        remove a WAL segment still needed by the standby, in which case the
        replication connection will be terminated.  Downstream connections
        will also eventually fail as a result.  (However, the standby
        server can recover by fetching the segment from archive, if WAL
        archiving is in use.)
       </para>

       <para>
        This sets only the minimum size of segments retained in
        <filename>pg_wal</filename>; the system might need to retain more segments
        for WAL archival or to recover from a checkpoint. If
        <varname>wal_keep_size</varname> is zero (the default), the system
        doesn't keep any extra segments for standby purposes, so the number
        of old WAL segments available to standby servers is a function of
        the location of the previous checkpoint and status of WAL
        archiving.
        If this value is specified without units, it is taken as megabytes.
        This parameter can only be set in the
        <filename>postgresql.conf</filename> file or on the server command line.
       </para>
       </listitem>
      </varlistentry>

      <varlistentry id="guc-max-slot-wal-keep-size" xreflabel="max_slot_wal_keep_size">

Title: Sending Server Replication Parameters: max_replication_slots, wal_keep_size
Summary
This section describes additional parameters for configuring sending servers in PostgreSQL replication. `max_replication_slots` defines the maximum number of replication slots the server can support, requiring `wal_level` to be set to replica or higher. `wal_keep_size` specifies the minimum size of WAL files kept in `pg_wal` to accommodate standby servers that may fall behind in streaming replication. Setting it to zero disables keeping extra segments for standby purposes.