Following software must be installed on both servers:
At network level, connections between the LightDB port (default: 5432
)
must be possible between all nodes.
Passwordless SSH
connectivity between all servers in the replication cluster
is not required, but is necessary in the following cases:
rsync
must also be installed on all servers.
ltcluster cluster matrix
and ltcluster cluster crosscheck
Consider setting ConnectTimeout
to a low value in your SSH configuration.
This will make it faster to detect any SSH connection errors.
The following LightDB configuration parameters may need to be changed in order for ltcluster (and replication itself) to function correctly.
hot_standby
hot_standby
must always be set to on
, as ltcluster needs
to be able to connect to each server it manages.
Note that hot_standby
defaults to on
from LightDB 21
and later.
LightDB documentation: hot_standby.
wal_level
wal_level
must be one of replica
or logical
.
LightDB documentation: wal_level.
max_wal_senders
max_wal_senders
must be set to a value of 2
or greater.
In general you will need one WAL sender for each standby which will attach to the LightDB
instance; additionally ltcluster will require two free WAL senders in order to clone further
standbys.
max_wal_senders
should be set to an appropriate value on all LightDB
instances in the replication cluster which may potentially become a primary server or
(in cascading replication) the upstream server of a standby.
LightDB documentation: max_wal_senders.
From LightDB 21, max_wal_senders
must be set to the same or a higher value as the primary node
(at the time the node was cloned), otherwise the standby will refuse
to start (unless hot_standby
is set to off
, which
will prevent the node from accepting queries).
max_replication_slots
If you are intending to use replication slots, max_replication_slots
must be set to a non-zero value.
max_replication_slots
should be set to an appropriate value on all LightDB
instances in the replication cluster which may potentially become a primary server or
(in cascading replication) the upstream server of a standby.
LightDB documentation: max_replication_slots.
wal_log_hints
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.
LightDB documentation: wal_log_hints.
archive_mode
We suggest setting archive_mode
to on
(and
archive_command
to /bin/true
; see below)
even if you are currently not planning to use WAL file archiving.
This will make it simpler to set up WAL file archiving if it is ever required,
as changes to archive_mode
require a full LightDB server
restart, while archive_command
changes can be applied via a normal
configuration reload.
However, ltcluster itself does not require WAL file archiving.
LightDB documentation: archive_mode.
archive_command
If you have set archive_mode
to on
but are not currently planning
to use WAL file archiving, set archive_command
to a command which does nothing but returns
true
, such as /bin/true
. See above for details.
LightDB documentation: archive_command.
wal_keep_segments
/ wal_keep_size
Normally there is no need to set wal_keep_segments
(LightDB 21 and later: wal_keep_size
; default: 0
),
as it is not a reliable way of ensuring that all required WAL
segments are available to standbys. Replication slots and/or an archiving solution
are recommended to ensure standbys have a reliable
source of WAL segments at all times.
The only reason ever to set wal_keep_segments
/ wal_keep_size
is you have you have configured pg_basebackup_options
in ltcluster.conf
to include the setting --wal-method=fetch
and you have not set restore_command
in ltcluster.conf
to fetch WAL files from a reliable source,
in which case you'll need to set wal_keep_segments
to a sufficiently high number to ensure that all WAL files required by the standby
are retained. However we do not recommend WAL retention in this way.
LightDB documentation: wal_keep_segments.
See also the LightDB configuration section in the Quick-start guide.