2.2. LightDB configuration

On the primary server, a LightDB instance must be initialised and running. The following replication settings may need to be adjusted:


    # Enable replication connections; set this value to at least one more
    # than the number of standbys which will connect to this server
    # (note that ltcluster will execute "lt_basebackup" in WAL streaming mode,
    # which requires two free WAL senders).
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-replication.html#GUC-MAX-WAL-SENDERS

    max_wal_senders = 10

    # If using replication slots, set this value to at least one more
    # than the number of standbys which will connect to this server.
    # Note that ltcluster will only make use of replication slots if
    # "use_replication_slots" is set to "true" in "ltcluster.conf".
    # (If you are not intending to use replication slots, this value
    # can be set to "0").
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS

    max_replication_slots = 10

    # Ensure WAL files contain enough information to enable read-only queries
    # on the standby.
    #
    #  LightDB 21 and later: one of 'replica' or 'logical'
    #    ('hot_standby' will still be accepted as an alias for 'replica')
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-wal.html#GUC-WAL-LEVEL

    wal_level = 'hot_standby'

    # Enable read-only queries on a standby
    # (Note: this will be ignored on a primary but we recommend including
    # it anyway, in case the primary later becomes a standby)
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-replication.html#GUC-HOT-STANDBY

    hot_standby = on

    # Enable WAL file archiving
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-wal.html#GUC-ARCHIVE-MODE

    archive_mode = on

    # Set archive command to a dummy command; this can later be changed without
    # needing to restart the LightDB instance.
    #
    # See: https://www.hs.net/lightdb/docs/html/runtime-config-wal.html#GUC-ARCHIVE-COMMAND

    archive_command = '/bin/true'
   

Tip

Rather than editing these settings in the default lightdb.conf file, create a separate file such as postgresql.replication.conf and include it from the end of the main configuration file with: include 'postgresql.replication.conf'.

Additionally, if you are intending to use lt_rewind, and the cluster was not initialised using data checksums, you may want to consider enabling wal_log_hints; for more details see Using lt_rewind.

See also the LightDB configuration section in the ltcluster configuration guide.