This commit is contained in:
ace
2023-07-04 00:00:54 +03:00
parent 2ac7f6244f
commit e862d9f27b
5 changed files with 43 additions and 12 deletions

View File

@ -36,9 +36,21 @@ patroni_play_group: "patroni"
patroni_dcs_exists: false
patroni_dcs_type: "consul"
## Backup options
## Backup and restore options
patroni_wal_g_install: false
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_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 '' }}"
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
@ -77,6 +89,14 @@ patroni_create_replica_methods:
# Dynamic configuration
patroni_postgresql_dynamic_parameters: {}
patroni_postgresql_backup_parameters:
postgresql:
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:
max_connections: "1000"
@ -111,9 +131,6 @@ patroni_postgresql_default_parameters:
autovacuum_vacuum_cost_delay: "2"
autovacuum_naptime: "1s"
max_files_per_process: "4096"
archive_mode: "on"
archive_timeout: "1800s"
archive_command: "cd ."
wal_level: "replica"
wal_keep_size: "2GB"
max_wal_senders: "10"