mirror of
https://gitea.0xace.cc/ansible-galaxy/patroni.git
synced 2025-06-29 02:53:07 +00:00
add restore support
This commit is contained in:
@ -23,7 +23,8 @@ patroni_replication_password: "replicator"
|
||||
# Patroni REST API options
|
||||
patroni_restapi_username: "admin"
|
||||
patroni_restapi_password: "admin"
|
||||
patroni_restapi_listen_port: 8008
|
||||
patroni_restapi_listen_port: "8008"
|
||||
patroni_restapi_listen_address: "0.0.0.0"
|
||||
|
||||
# Patroni SSL options
|
||||
patroni_ssl: false
|
||||
@ -36,21 +37,30 @@ patroni_play_group: "patroni"
|
||||
patroni_dcs_exists: false
|
||||
patroni_dcs_type: "consul"
|
||||
|
||||
## Backup and restore options
|
||||
## WAL-G backup and restore options
|
||||
patroni_wal_g_install: false
|
||||
patroni_wal_g_restore_from_backup: false
|
||||
patroni_wal_g_pitr: 'latest'
|
||||
patroni_wal_g_restore_backup_name: 'LATEST'
|
||||
patroni_wal_g_pg_binary_name: 'wal-g-pg'
|
||||
patroni_postgresql_archive_mode: "{{ 'on' if patroni_wal_g_install else 'off' }}"
|
||||
patroni_postgresql_archive_command: "{{ 'http_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ 'https_proxy=' ~ wal_g_https_proxy ~ ' ' if wal_g_https_proxy is defined else 'https_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ wal_g_pg_binary_name ~ ' wal-push %p' if patroni_wal_g_install else '' }}"
|
||||
patroni_wal_g_config_name: ".walg.json"
|
||||
patroni_wal_g_restore_config_name: ".walg-restore.json"
|
||||
patroni_restore_script: "{{ patroni_postgresql_home_dir }}/restore.sh"
|
||||
#patroni_postgresql_archive_command: "wal-g wal-push %p"
|
||||
#patroni_postgresql_restore_command: "wal-g wal-fetch %f %p"
|
||||
#patroni_cluster_bootstrap_command: "wal-g backup-fetch latest"
|
||||
## "restore_command" written to recovery.conf when configuring follower (create replica)
|
||||
#patroni_cluster_restore_command: "wal-g wal-fetch %f %p"
|
||||
#patroni_wal_g_create_replica_methods:
|
||||
# - {option: "command", value: "{{ patroni_cluster_bootstrap_command }}"}
|
||||
# - {option: "no_params", value: "True"}
|
||||
#patroni_basebackup_create_replica_methods:
|
||||
# - {option: "max-rate", value: "1000M"}
|
||||
# - {option: "checkpoint", value: "fast"}
|
||||
|
||||
patroni_wal_g_create_replica_methods:
|
||||
- {option: "command", value: "{{ 'http_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ 'https_proxy=' ~ wal_g_https_proxy ~ ' ' if wal_g_https_proxy is defined else 'https_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ wal_g_pg_binary_name }} backup-fetch {{ patroni_postgresql_data_dir }} LATEST"}
|
||||
- {option: "no_params", value: "True"}
|
||||
patroni_basebackup_create_replica_methods:
|
||||
- {option: "max-rate", value: "1000M"}
|
||||
- {option: "checkpoint", value: "fast"}
|
||||
|
||||
# "restore_command" written to recovery.conf when configuring follower (create replica)
|
||||
patroni_postgresql_restore_command: "{{ 'http_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ 'https_proxy=' ~ wal_g_https_proxy ~ ' ' if wal_g_https_proxy is defined else 'https_proxy=' ~ wal_g_http_proxy ~ ' ' if wal_g_http_proxy is defined else '' }}{{ wal_g_pg_binary_name ~ ' wal-fetch %f %p' if patroni_wal_g_install else '' }}"
|
||||
# More examples
|
||||
# patroni_postgresql_restore_command: "pgbackrest --stanza={{ pgbackrest_stanza }} archive-get %f %p" # restore WAL-s using pgbackrest
|
||||
# patroni_postgresql_restore_command: "pg_probackup-{{ pg_probackup_version }} archive-get -B {{ pg_probackup_dir }} --instance {{ pg_probackup_instance }} --wal-file-path=%p --wal-file-name=%f" # restore WAL-s using pg_probackup
|
||||
|
||||
patroni_synchronous_mode: false # or 'true' for enable synchronous database replication
|
||||
patroni_synchronous_mode_strict: false # if 'true' then block all client writes to the master, when a synchronous replica is not available
|
||||
@ -94,11 +104,11 @@ patroni_postgresql_backup_parameters:
|
||||
parameters:
|
||||
archive_command: "{{ patroni_postgresql_archive_command if patroni_wal_g_install else 'cd .' }}"
|
||||
restore_command: "{{ patroni_postgresql_restore_command if patroni_wal_g_install else 'cd .' }}"
|
||||
archive_mode: "on"
|
||||
archive_timeout: "1800s"
|
||||
|
||||
# postgresql parameters to bootstrap dcs (are parameters for example)
|
||||
patroni_postgresql_default_parameters:
|
||||
archive_mode: "on"
|
||||
archive_timeout: "1800s"
|
||||
max_connections: "1000"
|
||||
superuser_reserved_connections: "5"
|
||||
password_encryption: "{{ patroni_postgresql_password_encryption_algorithm }}"
|
||||
|
Reference in New Issue
Block a user