Skip to content
Snippets Groups Projects
Commit 0a2e6450 authored by Baptiste DE RENZO's avatar Baptiste DE RENZO
Browse files

pgsql: enable repmgrd logs, add comments and remove event script refs #33392

parent e32de3a4
No related branches found
No related tags found
No related merge requests found
...@@ -67,4 +67,16 @@ ...@@ -67,4 +67,16 @@
become: yes become: yes
become_user: postgres become_user: postgres
when: copy_from_primary is succeeded when: copy_from_primary is succeeded
- name: REPMGRD RESTART
hosts: postgres
tags: [ 'never', 'restart-repmgrd' ]
tasks:
- name: kill repmgrd
command: "pkill repmgrd"
ignore_errors: yes
- name: restart repmgrd
systemd:
name: repmgrd
state: restarted
... ...
...@@ -83,12 +83,6 @@ ...@@ -83,12 +83,6 @@
regexp: '^#?{{ item.key }}=.*$' regexp: '^#?{{ item.key }}=.*$'
replace: '{{ item.key }}={{ item.value }}' replace: '{{ item.key }}={{ item.value }}'
- name: copy events notification script
template:
src: repmgr-event.py.j2
dest: /usr/bin/repmgr-event
mode: 0755
- name: configure sudo - name: configure sudo
copy: copy:
dest: /etc/sudoers.d/postgres dest: /etc/sudoers.d/postgres
......
# https://raw.githubusercontent.com/2ndQuadrant/repmgr/master/repmgr.conf.sample
#------------------------------------------------------------------------------
# Node configuration settigns
#------------------------------------------------------------------------------
# node information
node_id={{ repmgr_node_id }} node_id={{ repmgr_node_id }}
node_name={{ repmgr_node_name }} node_name={{ repmgr_node_name }}
# database connection information
conninfo='{{ repmgr_conninfo }}' conninfo='{{ repmgr_conninfo }}'
# repmgr data directory
data_directory='/var/lib/postgresql/{{ repmgr_pg_version }}/{{ repmgr_pg_cluster }}' data_directory='/var/lib/postgresql/{{ repmgr_pg_version }}/{{ repmgr_pg_cluster }}'
# log level
log_level='INFO'
# log to file
log_file='/var/log/postgresql/repmgrd.log'
#------------------------------------------------------------------------------
# Replication settings
#------------------------------------------------------------------------------
# physical replication slots (at least the number of standbys which will connect to the primary)
use_replication_slots=1 use_replication_slots=1
event_notification_command='/usr/bin/repmgr-event %n %e %s "%t" "%d"'
#------------------------------------------------------------------------------
# Event notification settings
#------------------------------------------------------------------------------
# RM#33392
# external program or script (should be executable by repmgr user)
#event_notification_command='/usr/bin/repmgr-event %n %e %s "%t" "%d"'
#------------------------------------------------------------------------------
# Environment/command settings
#------------------------------------------------------------------------------
# path to PostgreSQL binary directory ((location of pg_ctl, pg_basebackup etc.)
pg_bindir='/usr/lib/postgresql/{{ repmgr_pg_version }}/bin/' pg_bindir='/usr/lib/postgresql/{{ repmgr_pg_version }}/bin/'
#------------------------------------------------------------------------------
# external command options
#------------------------------------------------------------------------------
# options to append to "pg_ctl"
pg_ctl_options='-s' pg_ctl_options='-s'
# options to append to "pg_basebackup"
pg_basebackup_options='--label=repmgr_backup' pg_basebackup_options='--label=repmgr_backup'
#------------------------------------------------------------------------------
# Failover and monitoring settings (repmgrd)
#------------------------------------------------------------------------------
# The max length of time (in seconds) to wait for the new primary to become available
primary_follow_timeout=30 primary_follow_timeout=30
# 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
failover=automatic failover=automatic
# Number of attempts which will be made to reconnect to an unreachable primary (or other upstream node)
reconnect_attempts=6 reconnect_attempts=6
# Interval between attempts to reconnect to an unreachable primary (or other upstream node)
reconnect_interval=5 reconnect_interval=5
# command repmgrd executes when promoting a new primary
promote_command='repmgr -f {{ repmgr_config }} standby promote' promote_command='repmgr -f {{ repmgr_config }} standby promote'
# command repmgrd executes when instructing a standby to follow a new primary
follow_command='repmgr -f {{ repmgr_config }} standby follow -W' follow_command='repmgr -f {{ repmgr_config }} standby follow -W'
#------------------------------------------------------------------------------
# service control commands
#------------------------------------------------------------------------------
# override the default pg_ctl commands used to stop, start, restart, reload and promote the PostgreSQL cluster
service_start_command='sudo systemctl start postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}' service_start_command='sudo systemctl start postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}'
service_stop_command='sudo systemctl stop postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}' service_stop_command='sudo systemctl stop postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}'
service_restart_command='sudo systemctl restart postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}' service_restart_command='sudo systemctl restart postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}'
service_reload_command='sudo systemctl reload postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}' service_reload_command='sudo systemctl reload postgresql@{{ repmgr_pg_version }}-{{ repmgr_pg_cluster }}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment