Files
PostgreSQL-Ansible/roles/postgres/templates/postgresql.conf.j2
2026-01-29 14:27:03 +01:00

52 lines
1.1 KiB
Django/Jinja

# PostgreSQL Configuration for Production
# Debian 13 - najnowsza dostępna wersja
# Primary: pg1, Replica: pg2
# --- Network ---
listen_addresses = '*'
max_connections = 200
port = 5432
# --- Memory (dla 8GB RAM) ---
shared_buffers = 2GB
effective_cache_size = 6GB
work_mem = 64MB
maintenance_work_mem = 1GB
# --- WAL and Logging ---
wal_level = replica
wal_compression = on
max_wal_senders = 10
max_replication_slots = 10
wal_keep_size = 10GB
# --- Archiving (dla pgBackRest) ---
archive_mode = on
archive_command = 'pgbackrest --stanza=main archive-push %p'
archive_timeout = 300
# --- Checkpoints ---
checkpoint_timeout = 15min
checkpoint_completion_target = 0.9
max_wal_size = 64GB
min_wal_size = 16GB
# --- Logging ---
log_directory = '/var/log/postgresql'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
log_rotation_size = 100MB
log_min_duration_statement = 1000
log_connections = on
log_disconnections = on
log_duration = off
# --- Replication slots ---
max_replication_slots = 10
# --- Performance ---
random_page_cost = 1.1
effective_io_concurrency = 200
synchronous_commit = local