forked from ISTI-ansible-roles/ansible-roles
library/roles/postgresql: Fix the pgpool recovery scripts to be compatible with pgpool 2.5.
This commit is contained in:
parent
2a1212a176
commit
c8463c62a9
|
@ -39,7 +39,7 @@
|
|||
tags: [ 'postgresql', 'postgres', 'pgpool' ]
|
||||
|
||||
- name: Install the pgpool recovery and remote restart scripts. They assume that the postgresql hosts can talk to each other
|
||||
template: src={{ item.1 }}.j2 dest={{ item.0.backend_data_directory }}/{{ item.1 }} owner=postgres group=postgres mode=0500
|
||||
template: src={{ item.1 }}.j2 dest={{ item.0.backend_data_directory }}/main/{{ item.1 }} owner=postgres group=postgres mode=0500
|
||||
with_nested:
|
||||
- '{{ pgpool_backends | default([]) }}'
|
||||
- [ '{{ pgpool_recovery_stage1_script }}', '{{ pgpool_recovery_stage2_script }}', '{{ pgpool_remote_start_script }}' ]
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
#
|
||||
TS=$(date +%Y-%m-%d_%H-%M-%S)
|
||||
MASTER_HOST=$(hostname -f)
|
||||
# The variables $1 and $3 are {{ psql_data_dir }}/main
|
||||
# $1 is {{ psql_data_dir }}/main while $3 is {{ psql_data_dir }}
|
||||
MASTER_DATA=$1
|
||||
MASTER_DATA_BASE_DIR={{ psql_data_dir }}
|
||||
RECOVERY_TARGET=$2
|
||||
RECOVERY_DATA=$3
|
||||
RECOVERY_TARGET=${2}
|
||||
RECOVERY_DATA=${3}/main
|
||||
RECOVERY_DATA_BASE_DIR={{ psql_data_dir }}
|
||||
|
||||
logger "pgpool_recovery_1: MASTER_DATA=$MASTER_DATA"
|
||||
logger "pgpool_recovery_1: RECOVERY_DATA=$RECOVERY_DATA"
|
||||
|
||||
archive_dir={{ psql_wal_archiving_log_dir }}
|
||||
|
||||
# Ensure that postgres is shut down on the target node
|
||||
|
|
|
@ -2,14 +2,19 @@
|
|||
# Online recovery 2nd stage script
|
||||
#
|
||||
MASTER_DATA_BASE_DIR={{ psql_data_dir }}
|
||||
MASTER_DATA=$1
|
||||
RECOVERY_TARGET=$2
|
||||
MASTER_DATA=${1}
|
||||
RECOVERY_TARGET=${2}
|
||||
RECOVERY_DATA_BASE_DIR={{ psql_data_dir }}
|
||||
RECOVERY_DATA=$3
|
||||
RECOVERY_DATA=${3}
|
||||
port={{ psql_db_port }} # PostgreSQL port number
|
||||
|
||||
archive_dir={{ psql_wal_archiving_log_dir }}
|
||||
|
||||
logger "pgpool_recovery_2: MASTER_DATA=$MASTER_DATA"
|
||||
logger "pgpool_recovery_2: RECOVERY_DATA=$RECOVERY_DATA"
|
||||
logger "pgpool_recovery_2: archive_dir=$archive_dir"
|
||||
|
||||
|
||||
# Force to flush current value of sequences to xlog
|
||||
psql -p $port -t -c 'SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn' template1|
|
||||
while read i
|
||||
|
|
Loading…
Reference in New Issue