Both sides previous revision Previous revision Next revision | Previous revision |
postgresql_repmgr_installation [2021/09/28 11:26] – [Automatic Failover] andonovj | postgresql_repmgr_installation [2021/09/28 11:30] (current) – andonovj |
---|
</Code> | </Code> |
| |
| |
| For that configuration I have used the following appendix: |
| ===Appendix=== |
| <Code:bash|repmgrd.conf> |
| node_id='2' # A unique integer greater than zero (1/2 depends on the node) |
| node_name='server2' # An arbitrary (but unique) string; we recommend. (unique number for the cluster) |
| conninfo='host=server1 user=repmgr dbname=repmgr connect_timeout=2' # Database connection information as a conninfo string. |
| data_directory='/var/lib/postgresql/12/main' # The node's data directory. This is needed by repmgr |
| config_directory='/etc/postgresql/12/main' # If configuration files are located outside the data |
| replication_user='repmgr' # User to make replication connections with, if not set |
| replication_type='physical' # Must be one of "physical" or "bdr". |
| location='default' # An arbitrary string defining the location of the node; this |
| use_replication_slots='yes' # whether to use physical replication slots |
| witness_sync_interval=15 # interval (in seconds) to synchronise node records |
| log_level='DEBUG' # Log level: possible values are DEBUG, INFO, NOTICE, |
| log_facility='STDERR' # Logging facility: possible values are STDERR, or for |
| log_file='/var/log/postgresql/repmgr.log' |
| log_status_interval=300 # interval (in seconds) for repmgrd to log a status message |
| pg_bindir='/usr/lib/postgresql/12/bin' # Path to PostgreSQL binary directory (location |
| repmgr_bindir='/usr/lib/postgresql/12/bin' # Path to repmgr binary directory (location of the repmgr |
| use_primary_conninfo_password=false # explicitly set "password" in "primary_conninfo" |
| passfile='/var/lib/postgresql/12/main/.pgpass' # path to .pgpass file to include in "primary_conninfo" |
| ssh_options='-o StrictHostKeyChecking=no' # Options to append to "ssh" |
| promote_check_timeout=60 # The length of time (in seconds) to wait |
| promote_check_interval=1 # The interval (in seconds) to check whether |
| primary_follow_timeout=60 # The max length of time (in seconds) to wait |
| standby_follow_timeout=15 # The max length of time (in seconds) to wait |
| shutdown_check_timeout=60 # The max length of time (in seconds) to wait for the demotion |
| standby_reconnect_timeout=60 # The max length of time (in seconds) to wait |
| node_rejoin_timeout=60 # The maximum length of time (in seconds) to wait for |
| failover='automatic' # one of 'automatic', 'manual'. |
| priority=100 # indicates a preferred priority for promoting nodes; |
| reconnect_attempts=6 # Number of attempts which will be made to reconnect to an unreachable |
| reconnect_interval=10 # Interval between attempts to reconnect to an unreachable |
| promote_command='repmgr standby promote -f /etc/repmgr.conf --log-to-file' # command repmgrd executes when promoting a new primary; use something like: |
| follow_command='repmgr standby follow -f /etc/repmgr.conf --log-to-file --upstream-node-id=%n' # command repmgrd executes when instructing a standby to follow a new primary; |
| primary_notification_timeout=60 # Interval (in seconds) which repmgrd on a standby |
| repmgrd_standby_startup_timeout=60 # Interval (in seconds) which repmgrd on a standby will wait |
| monitoring_history=no # Whether to write monitoring data to the "montoring_history" table |
| monitor_interval_secs=2 # Interval (in seconds) at which to write monitoring data |
| degraded_monitoring_timeout=-1 # Interval (in seconds) after which repmgrd will terminate if the |
| async_query_timeout=60 # Interval (in seconds) which repmgrd will wait before |
| standby_disconnect_on_failover=false # If "true", in a failover situation wait for all standbys to |
| primary_visibility_consensus=false # If "true", only continue with failover if no standbys have seen |
| service_start_command ='sudo systemctl start postgresql' |
| service_stop_command ='sudo systemctl stop postgresql' |
| service_restart_command ='sudo systemctl restart postgresql' |
| service_reload_command ='sudo systemctl reload postgresql' |
| archive_ready_warning=16 # repmgr node check --archive-ready |
| archive_ready_critical=128 # |
| replication_lag_warning=300 # repmgr node check --replication-lag |
| replication_lag_critical=600 # |
| bdr_local_monitoring_only=false # Only monitor the local node; no checks will be |
| bdr_recovery_timeout=30 # If a BDR node was offline and has become available |
| </Code> |
====Manual Failover==== | ====Manual Failover==== |
| |