add restore support

This commit is contained in:
ace
2023-07-21 17:13:51 +03:00
parent 11d311a96a
commit 4759d93a91
12 changed files with 77 additions and 41 deletions

View File

@ -25,7 +25,7 @@ ctl:
cafile: {{ patroni_ssl_path }}/CA-cert.crt
restapi:
listen: 0.0.0.0:{{ patroni_restapi_listen_port }}
listen: {{ patroni_restapi_listen_address }}:{{ patroni_restapi_listen_port }}
connect_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:{{ patroni_restapi_listen_port }}
{% if patroni_ssl|bool %}
certfile: {{ patroni_ssl_path }}/{{ patroni_self_signed_cert_name }}.crt
@ -57,12 +57,12 @@ bootstrap:
method: {{ patroni_cluster_bootstrap_method }}
{% if patroni_cluster_bootstrap_method == 'wal-g' %}
wal-g:
command: {{ patroni_wal_g_cluster_bootstrap_command }}
command: {{ patroni_restore_script }}
no_params: True
recovery_conf:
recovery_target_action: promote
recovery_target_timeline: latest
restore_command: {{ patroni_wal_g_pg_binary_name }} wal-fetch %f %p
recovery_target_timeline: {{ patroni_wal_g_pitr }}
restore_command: {{ patroni_cluster_restore_command }}
{% endif %}
{% if patroni_cluster_bootstrap_method == 'pg_probackup' %}
pg_probackup:
@ -126,9 +126,9 @@ postgresql:
listen: {{ hostvars[inventory_hostname]['ansible_host'] }},127.0.0.1:{{ patroni_postgresql_port }}
connect_address: {{ hostvars[inventory_hostname]['ansible_host'] }}:{{ patroni_postgresql_port }}
use_unix_socket: true
data_dir: {{ patroni_postgresql_home_dir }}/{{ patroni_postgresql_major_version }}/data
data_dir: {{ patroni_postgresql_home_dir }}/{{ patroni_postgresql_major_version }}/{{ patroni_postgresql_cluster_name }}
bin_dir: {{ patroni_postgresql_bin_dir }}
config_dir: {{ patroni_postgresql_home_dir }}/{{ patroni_postgresql_major_version }}/data
config_dir: {{ patroni_postgresql_home_dir }}/{{ patroni_postgresql_major_version }}/{{ patroni_postgresql_cluster_name }}
pgpass: {{ patroni_postgresql_home_dir }}/.pgpass_patroni
authentication:
replication:
@ -215,11 +215,6 @@ postgresql:
max-rate: '100M'
{% endif %}
{% if patroni_postgresql_restore_command is defined and patroni_postgresql_restore_command | length > 0 and patroni_wal_g_install %}
recovery_conf:
restore_command: {{ patroni_postgresql_restore_command }}
{% endif %}
watchdog:
mode: off # Allowed values: off, automatic, required
device: /dev/watchdog

2
templates/restore.sh.j2 Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
{{ patroni_cluster_bootstrap_command }}