|
| 1 | +# ---------------------------- |
| 2 | +# pgPool-II configuration file |
| 3 | +# ---------------------------- |
| 4 | +# |
| 5 | +# Docs: https://www.pgpool.net/docs/latest/en/html/configuring-pgpool.html#:~:text=conf%20is%20the%20main%20configuration,%24prefix%2Fetc%2Fpgpool. |
| 6 | + |
| 7 | +#------------------------------------------------------------------------------ |
| 8 | +# BACKEND CLUSTERING MODE |
| 9 | +#------------------------------------------------------------------------------ |
| 10 | + |
| 11 | +backend_clustering_mode = 'streaming_replication' |
| 12 | + |
| 13 | + |
| 14 | +#------------------------------------------------------------------------------ |
| 15 | +# CONNECTIONS |
| 16 | +#------------------------------------------------------------------------------ |
| 17 | + |
| 18 | +# - pgpool Connection Settings - |
| 19 | + |
| 20 | +listen_addresses = '*' |
| 21 | +port = 5432 |
| 22 | + |
| 23 | +# - pgpool Communication Manager Connection Settings - |
| 24 | + |
| 25 | +pcp_listen_addresses = 'localhost' |
| 26 | +pcp_port = 9898 |
| 27 | + |
| 28 | +# - Backend Connection Settings - |
| 29 | + |
| 30 | +backend_hostname0 = 'primary' |
| 31 | +backend_port0 = 5432 |
| 32 | +backend_weight0 = 1 |
| 33 | +backend_data_directory0 = '/var/lib/postgresql/data' |
| 34 | +backend_flag0 = 'ALLOW_TO_FAILOVER' |
| 35 | +backend_application_name0 = 'primary' |
| 36 | + |
| 37 | +backend_hostname1 = 'secondary' |
| 38 | +backend_port1 = 5432 |
| 39 | +backend_weight1 = 1 |
| 40 | +backend_data_directory1 = '/var/lib/postgresql/data' |
| 41 | +backend_flag1 = 'ALLOW_TO_FAILOVER' |
| 42 | +backend_application_name1 = 'secondary' |
| 43 | + |
| 44 | +# - Authentication - |
| 45 | + |
| 46 | +enable_pool_hba = on |
| 47 | + |
| 48 | +# - SSL Connections - |
| 49 | + |
| 50 | +#------------------------------------------------------------------------------ |
| 51 | +# LOGS |
| 52 | +#------------------------------------------------------------------------------ |
| 53 | + |
| 54 | +# - Where to log - |
| 55 | +log_per_node_statement = on |
| 56 | + |
| 57 | + |
| 58 | +#------------------------------------------------------------------------------ |
| 59 | +# LOAD BALANCING MODE |
| 60 | +#------------------------------------------------------------------------------ |
| 61 | + |
| 62 | +load_balance_mode = on |
| 63 | + |
| 64 | + |
| 65 | +#------------------------------------------------------------------------------ |
| 66 | +# STREAMING REPLICATION MODE |
| 67 | +#------------------------------------------------------------------------------ |
| 68 | + |
| 69 | +# - Streaming - |
| 70 | + |
| 71 | +sr_check_period = 2 |
| 72 | +sr_check_user = 'postgres' |
| 73 | +sr_check_password = '${POSTGRES_PASSWORD}' |
| 74 | +sr_check_database = 'postgres' |
| 75 | + |
| 76 | + |
| 77 | +#------------------------------------------------------------------------------ |
| 78 | +# HEALTH CHECK GLOBAL PARAMETERS |
| 79 | +#------------------------------------------------------------------------------ |
| 80 | + |
| 81 | +health_check_period = 30 |
| 82 | +health_check_timeout = 20 |
| 83 | +health_check_user = 'postgres' |
| 84 | +health_check_password = '${POSTGRES_PASSWORD}' |
| 85 | +health_check_database = 'postgres' |
| 86 | +health_check_max_retries = 3 |
| 87 | +health_check_retry_delay = 10 |
| 88 | + |
| 89 | +#------------------------------------------------------------------------------ |
| 90 | +# FAILOVER AND FAILBACK |
| 91 | +#------------------------------------------------------------------------------ |
| 92 | +failover_command = 'PGPASSWORD=${POSTGRES_PASSWORD} psql --host secondary -U postgres -c "SELECT pg_promote();"' |
| 93 | +failover_on_backend_error = on |
| 94 | +failover_on_backend_shutdown = on |
| 95 | +detach_false_primary = on |
| 96 | + |
| 97 | +#------------------------------------------------------------------------------ |
| 98 | +# ONLINE RECOVERY |
| 99 | +#------------------------------------------------------------------------------ |
| 100 | + |
| 101 | +auto_failback = on |
0 commit comments