mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
The repmgr3 implementation required the promotion candidate (standby) to directly work with the demotion candidate's data directory, directly execute server control commands etc. Here we delegated a lot more of that work to the repmgr on the demotion candidate, which reduces the amount of back-and-forth over SSH and generally makes things cleaner and smoother. In particular the repmgr on the demotion candidate will carry out a thorough check that the node is shut down and report the last checkpoint LSN to the promotion candidate; this can then be used to determine whether pg_rewind needs to be executed on the demoted primary before reintegrating it back into the cluster (todo). Also implement "--dry-run" for this action, which will sanity-check the nodes as far as possible without executing the switchover. Additionally some of the new repmgr node commands (or command options) introduced for this can be also executed by the user to obtain additional information about the status of each node.
257 lines
13 KiB
Plaintext
257 lines
13 KiB
Plaintext
###################################################
|
|
# repmgr sample configuration file
|
|
###################################################
|
|
|
|
# Some configuration items will be set with a default value; this
|
|
# is noted for each item. Where no default value is shown, the
|
|
# parameter will be treated as empty or false.
|
|
|
|
# =============================================================================
|
|
# Required configuration items
|
|
# =============================================================================
|
|
#
|
|
# repmgr and repmgrd require the following items to be explicitly configured.
|
|
|
|
|
|
#node_id= # A unique integer greater than zero
|
|
#node_name='' # An arbitrary (but unique) string; we recommend
|
|
# using the server's hostname or another identifier
|
|
# unambiguously associated with the server to avoid
|
|
# confusion. Avoid choosing names which reflect the
|
|
# node's current role, e.g. "primary" or "standby1",
|
|
# as roles can change and it will be confusing if
|
|
# the current primary is called "standby1".
|
|
|
|
#conninfo='' # Database connection information as a conninfo string.
|
|
# All servers in the cluster must be able to connect to
|
|
# the local node using this string.
|
|
#
|
|
# For details on conninfo strings, see:
|
|
# https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING
|
|
#
|
|
# If repmgrd is in use, consider explicitly setting
|
|
# "connect_timeout" in the conninfo string to determine
|
|
# the length of time which elapses before a network
|
|
# connection attempt is abandoned; for details see:
|
|
# https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT
|
|
|
|
#data_directory # The node's data directory. This is needed by repmgr
|
|
# when performing operations when the PostgreSQL instance
|
|
# is not running and there's no other way of determining
|
|
# the data directory.
|
|
|
|
# =============================================================================
|
|
|
|
# Optional configuration items
|
|
# =============================================================================
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Replication settings
|
|
#------------------------------------------------------------------------------
|
|
|
|
#replication_type=physical # Must be one of 'physical' or 'bdr'
|
|
|
|
#upstream_node_id= # When using cascading replication, a standby
|
|
# can connect to another upstream standby node
|
|
# which is specified by setting 'upstream_node_id'.
|
|
# In that case, the upstream node must exist
|
|
# before the new standby can be registered. If
|
|
# 'upstream_node_id' is not set, then the standby
|
|
# will connect directly to the primary node.
|
|
|
|
|
|
#use_replication_slots=no # whether to use physical replication slots
|
|
# NOTE: when using replication slots,
|
|
# 'max_replication_slots' should be configured for
|
|
# at least the number of standbys which will connect
|
|
# to the primary.
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Logging settings
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# Note that logging facility settings will only apply to `repmgrd` by default;
|
|
# `repmgr` will always write to STDERR unless the switch `--log-to-file` is
|
|
# supplied, in which case it will log to the same destination as `repmgrd`.
|
|
# This is mainly intended for those cases when `repmgr` is executed directly
|
|
# by `repmgrd`.
|
|
|
|
#log_level=INFO # Log level: possible values are DEBUG, INFO, NOTICE,
|
|
# WARNING, ERROR, ALERT, CRIT or EMERG
|
|
|
|
#log_facility=STDERR # Logging facility: possible values are STDERR, or for
|
|
# syslog integration, one of LOCAL0, LOCAL1, ..., LOCAL7, USER
|
|
|
|
#log_file='' # stderr can be redirected to an arbitrary file:
|
|
#log_status_interval=300 # interval (in seconds) for repmgrd to log a status message
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Event notification settings
|
|
#------------------------------------------------------------------------------
|
|
|
|
# event notifications can be passed to an arbitrary external program
|
|
# together with the following parameters:
|
|
#
|
|
# %n - node ID
|
|
# %e - event type
|
|
# %s - success (1 or 0)
|
|
# %t - timestamp
|
|
# %d - details
|
|
#
|
|
# the values provided for "%t" and "%d" will probably contain spaces,
|
|
# so should be quoted in the provided command configuration, e.g.:
|
|
#
|
|
# event_notification_command='/path/to/some/script %n %e %s "%t" "%d"'
|
|
#
|
|
# By default, all notifications will be passed; the notification types
|
|
# can be filtered to explicitly named ones, e.g.:
|
|
#
|
|
# event_notifications=master_register,standby_register
|
|
|
|
#event_notification_command='' # An external program or script which
|
|
# can be executed by the user under which
|
|
# repmgr/repmgrd are run.
|
|
|
|
#event_notifications='' # A commas-separated list of notification
|
|
# types
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Environment/command settings
|
|
#------------------------------------------------------------------------------
|
|
|
|
#pg_bindir='' # Path to PostgreSQL binary directory (location
|
|
# of pg_ctl, pg_basebackup etc.). Only needed
|
|
# if these files are not in the system $PATH.
|
|
#
|
|
# Debian/Ubuntu users: you will probably need to
|
|
# set this to the directory where `pg_ctl` is located,
|
|
# e.g. /usr/lib/postgresql/9.6/bin/
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
# external command options
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# Options which can be passed to external commands invoked by repmgr/repmgrd.
|
|
#
|
|
# Examples:
|
|
#
|
|
# pg_ctl_options='-s'
|
|
# pg_basebackup_options='--label=repmgr_backup
|
|
# rsync_options=--archive --checksum --compress --progress --rsh="ssh -o \"StrictHostKeyChecking no\""
|
|
# ssh_options=-o "StrictHostKeyChecking no"
|
|
|
|
#pg_ctl_options='' # Options to append to "pg_ctl"
|
|
#pg_basebackup_options='' # Options to append to "pg_basebackup"
|
|
#rsync_options='' # Options to append to "rsync"
|
|
ssh_options='-q' # Options to append to "ssh"
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Standby clone settings
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# These settings apply when cloning a standby ("repmgr standby clone").
|
|
#
|
|
# Examples:
|
|
#
|
|
# tablespace_mapping=/path/to/original/tablespace=/path/to/new/tablespace
|
|
# restore_command = 'cp /path/to/archived/wals/%f %p'
|
|
|
|
#tablespace_mapping='' # Tablespaces can be remapped from one
|
|
# file system location to another. This
|
|
# parameter can be provided multiple times.
|
|
|
|
#restore_command='' # This will be placed in the recovery.conf
|
|
# file generated by repmgr
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Standby follow settings
|
|
#------------------------------------------------------------------------------
|
|
|
|
# These settings apply when instructing a standby to follow the new primary
|
|
# ("repmgr standby follow").
|
|
|
|
#primary_follow_timeout=60 # The length of time (in seconds) to wait
|
|
# for the new primary to become available
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Barman options
|
|
#------------------------------------------------------------------------------
|
|
|
|
#barman_server='' # The barman configuration section
|
|
#barman_host='' # The host name of the barman server
|
|
#barman_config='' # The Barman configuration file on the
|
|
# Barman server (needed if the file is
|
|
# in a non-standard location)
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Failover and monitoring settings (repmgrd)
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# These settings are only applied when repmgrd is running. Values shown
|
|
# are defaults.
|
|
|
|
#failover_mode=manual # one of 'automatic', 'manual'.
|
|
# determines what action to take in the event of upstream failure
|
|
#
|
|
# 'automatic': repmgrd will automatically attempt to promote the
|
|
# node or follow the new upstream node
|
|
# 'manual': repmgrd will take no action and the node will require
|
|
# manual attention to reattach it to replication
|
|
# (does not apply to BDR mode)
|
|
#monitoring_history=no
|
|
|
|
#primary_notification_timeout=60 # Interval (in seconds) which repmgrd on a standby
|
|
# will wait for a notification from the new primary,
|
|
# before falling back to degraded monitoriong
|
|
#degraded_monitoring_timeout=-1 # Interval (in seconds) after which repmgrd
|
|
# will terminate if the server being monitored
|
|
# is no longer available. -1 (default) disables the
|
|
# timeout completely.
|
|
#async_query_timeout=60 # Interval (in seconds) which repmgrd will wait before
|
|
# cancelling an asynchronous query.
|
|
|
|
#------------------------------------------------------------------------------
|
|
# service control commands
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# repmgr provides options to override the default pg_ctl commands
|
|
# used to stop, start, restart, reload and promote the PostgreSQL cluster
|
|
#
|
|
# NOTE: These commands must be runnable on remote nodes as well for switchover
|
|
# to function correctly.
|
|
#
|
|
# If you use sudo, the user repmgr runs as (usually 'postgres') must have
|
|
# passwordless sudo access to execute the command.
|
|
#
|
|
# For example, to use systemd, you may use the following configuration:
|
|
#
|
|
# # this is required when running sudo over ssh without -t:
|
|
# Defaults:postgres !requiretty
|
|
# postgres ALL = NOPASSWD: /usr/bin/systemctl stop postgresql-9.6, \
|
|
# /usr/bin/systemctl start postgresql-9.6, \
|
|
# /usr/bin/systemctl restart postgresql-9.6
|
|
#
|
|
|
|
#service_start_command = ''
|
|
#service_stop_command = ''
|
|
#service_restart_command = ''
|
|
#service_reload_command = ''
|
|
#service_promote_command = '' # Note: this overrides any value contained
|
|
# in the setting "promote_command"
|
|
|
|
#------------------------------------------------------------------------------
|
|
# BDR monitoring options
|
|
#------------------------------------------------------------------------------
|
|
|
|
#bdr_local_monitoring_only=false # Only monitor the local node; no checks will be
|
|
# performed on the other node
|
|
#bdr_recovery_timeout # If a BDR node was offline and has become available
|
|
# maximum length of time in seconds to wait for the
|
|
# node to reconnect to the cluster
|