patroni/vars/main.yaml

155 lines
5.9 KiB
YAML
Raw Normal View History

2023-02-07 23:39:20 +00:00
patroni_postgresql_package_name: "postgresql"
patroni_postgresql_major_version: "{{ patroni_postgresql_version | split('.') | first }}"
patroni_postgresql_minor_version: "{{ patroni_postgresql_version | split('.') | last }}"
patroni_package_name: patroni
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
patroni_synchronous_node_count: 2 # number of synchronous standby databases
patroni_postgresql_port: "5432"
patroni_postgresql_encoding: "UTF8" # for bootstrap only (initdb)
patroni_postgresql_locale: "en_US.UTF-8" # for bootstrap only (initdb)
patroni_postgresql_data_checksums: true # for bootstrap only (initdb)
patroni_postgresql_password_encryption_algorithm: "scram-sha-256"
patroni_postgresql_unix_socket_dir: "/var/run/postgresql"
patroni_postgresql_stats_temp_directory_path: "/var/lib/pgsql_stats_tmp"
patroni_postgresql_use_pg_rewind: true # or 'false'
# try to use pg_rewind on the former leader when it joins cluster as a replica.
patroni_remove_data_directory_on_rewind_failure: false # or 'true' (if use_pg_rewind: 'true')
# avoid removing the data directory on an unsuccessful rewind
# if 'true', Patroni will remove the PostgreSQL data directory and recreate the replica.
patroni_remove_data_directory_on_diverged_timelines: false # or 'true'
# if 'true', Patroni will remove the PostgreSQL data directory and recreate the replica
# if it notices that timelines are diverging and the former master can not start streaming from the new master.
# https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#bootstrap
patroni_cluster_bootstrap_method: "initdb" # or "wal-g", "pgbackrest", "pg_probackup"
# https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#building-replicas
patroni_create_replica_methods:
# - pgbackrest
# - wal_g
# - pg_probackup
- basebackup
# Dynamic configuration
patroni_postgresql_dynamic_parameters: {}
# postgresql parameters to bootstrap dcs (are parameters for example)
patroni_postgresql_default_parameters:
max_connections: "1000"
superuser_reserved_connections: "5"
password_encryption: "{{ patroni_postgresql_password_encryption_algorithm }}"
max_locks_per_transaction: "64"
max_prepared_transactions: "0"
huge_pages: "try"
shared_buffers: "512MB"
work_mem: "128MB"
maintenance_work_mem: "256MB"
effective_cache_size: "4GB"
checkpoint_timeout: "15min"
checkpoint_completion_target: "0.9"
min_wal_size: "2GB"
max_wal_size: "8GB"
wal_buffers: "32MB"
default_statistics_target: "1000"
seq_page_cost: "1"
random_page_cost: "4"
effective_io_concurrency: "2"
synchronous_commit: "on"
autovacuum: "on"
autovacuum_max_workers: "5"
autovacuum_vacuum_scale_factor: "0.01"
autovacuum_analyze_scale_factor: "0.01"
autovacuum_vacuum_cost_limit: "500"
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"
max_replication_slots: "10"
hot_standby: "on"
wal_log_hints: "on"
wal_compression: "on"
shared_preload_libraries: "pg_stat_statements,auto_explain"
pg_stat_statements.max: "10000"
pg_stat_statements.track: "all"
pg_stat_statements.track_utility: "false"
pg_stat_statements.save: "true"
auto_explain.log_min_duration: "10s"
auto_explain.log_analyze: "true"
auto_explain.log_buffers: "true"
auto_explain.log_timing: "false"
auto_explain.log_triggers: "true"
auto_explain.log_verbose: "true"
auto_explain.log_nested_statements: "true"
track_io_timing: "on"
log_lock_waits: "on"
log_temp_files: "0"
track_activities: "on"
track_counts: "on"
track_functions: "all"
log_checkpoints: "on"
logging_collector: "on"
log_truncate_on_rotation: "on"
log_rotation_age: "1d"
log_rotation_size: "0"
log_line_prefix: "'%t [%p-%l] %r %q%u@%d '"
log_filename: "'postgresql-%a.log'"
log_directory: "{{ patroni_postgresql_log_dir }}"
hot_standby_feedback: "on"
max_standby_streaming_delay: "30s"
wal_receiver_status_interval: "10s"
idle_in_transaction_session_timeout: "10min"
jit: "off"
# archive_command: "wal-g wal-push %p"
# archive_command: "pgbackrest --stanza={{ pgbackrest_stanza }} archive-push %p"
# max_worker_processes: "24"
# max_parallel_workers: "12"
# max_parallel_workers_per_gather: "2"
# max_parallel_maintenance_workers: "2"
# old_snapshot_threshold: "60min"
# list of lines that Patroni will use to generate pg_ident.conf
patroni_postgresql_pg_ident: []
# - {mapname: "main", system_username: "postgres", pg_username: "backup"}
# - {mapname: "", system_username: "", pg_username: ""}
# Extended variables (optional)
patroni_ttl: 30
patroni_loop_wait: 10
patroni_retry_timeout: 10
patroni_maximum_lag_on_failover: 1048576
patroni_master_start_timeout: 300
# https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster
patroni_standby_cluster:
host: "" # an address of remote master
port: "5432" # a port of remote master
# primary_slot_name: "" # which slot on the remote master to use for replication (optional)
# restore_command: "" # command to restore WAL records from the remote master to standby leader (optional)
# recovery_min_apply_delay: "" # how long to wait before actually apply WAL records on a standby leader (optional)
patroni_log_destination: stderr # or 'logfile'
# if patroni_log_destination: logfile
patroni_log_dir: /var/log/patroni
patroni_log_level: info
patroni_log_traceback_level: error
patroni_log_format: "%(asctime)s %(levelname)s: %(message)s"
patroni_log_dateformat: ""
patroni_log_max_queue_size: 1000
patroni_log_file_num: 4
patroni_log_file_size: 25000000 # bytes
patroni_log_loggers_patroni_postmaster: warning
patroni_log_loggers_urllib3: warning # or 'debug'