]> git.openstreetmap.org Git - chef.git/blob - cookbooks/postgresql/templates/default/postgresql.conf.erb
Handle configuration of standby servers in Postgres 12 and later
[chef.git] / cookbooks / postgresql / templates / default / postgresql.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 #------------------------------------------------------------------------------
4 # FILE LOCATIONS
5 #------------------------------------------------------------------------------
6
7 data_directory = '/var/lib/postgresql/<%= @version %>/main'
8 hba_file = '/etc/postgresql/<%= @version %>/main/pg_hba.conf'
9 ident_file = '/etc/postgresql/<%= @version %>/main/pg_ident.conf'
10 external_pid_file = '/var/run/postgresql/<%= @version %>-main.pid'
11
12 #------------------------------------------------------------------------------
13 # CONNECTIONS AND AUTHENTICATION
14 #------------------------------------------------------------------------------
15
16 # - Connection Settings -
17
18 <% if @settings[:listen_addresses] || @defaults[:listen_addresses] -%>
19 listen_addresses = '<%= @settings[:listen_addresses] || @defaults[:listen_addresses] %>'
20 <% end -%>
21 port = <%= @settings[:port] || @defaults[:port] %>
22 max_connections = <%= @settings[:max_connections] || @defaults[:max_connections] %>
23 <% if @version.to_f >= 9.3 %>
24 unix_socket_directories = '/var/run/postgresql'
25 <% else -%>
26 unix_socket_directory = '/var/run/postgresql'
27 <% end -%>
28
29 # - Security and Authentication -
30
31 ssl = <%= @settings[:ssl] || @defaults[:ssl] %>
32 ssl_renegotiation_limit = 0
33
34 #------------------------------------------------------------------------------
35 # RESOURCE USAGE (except WAL)
36 #------------------------------------------------------------------------------
37
38 # - Memory -
39
40 shared_buffers = <%= @settings[:shared_buffers] || @defaults[:shared_buffers] %>
41 temp_buffers = <%= @settings[:temp_buffers] || @defaults[:temp_buffers] %>
42 work_mem = <%= @settings[:work_mem] || @defaults[:work_mem] %>
43 maintenance_work_mem = <%= @settings[:maintenance_work_mem] || @defaults[:maintenance_work_mem] %>
44 max_stack_depth = <%= @settings[:max_stack_depth] || @defaults[:max_stack_depth] %>
45
46 # - Asynchronous Behavior -
47
48 effective_io_concurrency = <%= @settings[:effective_io_concurrency] || @defaults[:effective_io_concurrency] %>
49 max_worker_processes = <%= @settings[:max_worker_processes] || @defaults[:max_worker_processes] %>
50 <% if @version.to_f >= 9.6 -%>
51 max_parallel_workers_per_gather = <%= @settings[:max_parallel_workers_per_gather] || @defaults[:max_parallel_workers_per_gather] %>
52 <% end -%>
53 <% if @version.to_f >= 10 -%>
54 max_parallel_workers = <%= @settings[:max_parallel_workers] || @defaults[:max_parallel_workers] %>
55 <% end -%>
56
57 #------------------------------------------------------------------------------
58 # WRITE AHEAD LOG
59 #------------------------------------------------------------------------------
60
61 # - Settings -
62
63 wal_level = <%= @settings[:wal_level] || @defaults[:wal_level] %>
64 fsync = <%= @settings[:fsync] || @defaults[:fsync] %>
65 synchronous_commit = <%= @settings[:synchronous_commit] || @defaults[:synchronous_commit] %>
66 wal_buffers = <%= @settings[:wal_buffers] || @defaults[:wal_buffers] %>
67 wal_writer_delay = <%= @settings[:wal_writer_delay] || @defaults[:wal_writer_delay] %>
68 commit_delay = <%= @settings[:commit_delay] || @defaults[:commit_delay] %>
69
70 # - Checkpoints -
71
72 <% if @version.to_f < 9.5 -%>
73 checkpoint_segments = <%= @settings[:checkpoint_segments] || @defaults[:checkpoint_segments] %>
74 <% end -%>
75 checkpoint_timeout = <%= @settings[:checkpoint_timeout] || @defaults[:checkpoint_timeout] %>
76 <% if @version.to_f >= 9.5 -%>
77 max_wal_size = <%= @settings[:max_wal_size] || @defaults[:max_wal_size] %>
78 min_wal_size = <%= @settings[:min_wal_size] || @defaults[:min_wal_size] %>
79 <% end -%>
80 checkpoint_completion_target = <%= @settings[:checkpoint_completion_target] || @defaults[:checkpoint_completion_target] %>
81
82 # - Archiving -
83
84 archive_mode = <%= @settings[:archive_mode] || @defaults[:archive_mode] %>
85 <% if @settings[:archive_command] || @defaults[:archive_command] -%>
86 archive_command = '<%= @settings[:archive_command] || @defaults[:archive_command] %>'
87 <% end -%>
88
89 # - Archive Recovery -
90
91 # These are only used in recovery mode.
92
93 <% if @settings[:restore_command] || @defaults[:restore_command] -%>
94 restore_command = '<%= if @settings[:restore_command] || @defaults[:restore_command] %>'
95 <% end -%>
96
97 #------------------------------------------------------------------------------
98 # REPLICATION
99 #------------------------------------------------------------------------------
100
101 # - Sending Server(s) -
102
103 max_wal_senders = <%= @settings[:max_wal_senders] || @defaults[:max_wal_senders] %>
104 <% if @version.to_f >= 9.4 -%>
105 max_replication_slots = <%= @settings[:max_replication_slots] || @defaults[:max_replication_slots] %>
106 <% end -%>
107
108 # - Standby Servers -
109
110 <% if @primary_conninfo -%>
111 primary_conninfo = 'host=<%= @primary_conninfo[:host] %> port=<%= @primary_conninfo[:port] %> user=<%= @primary_conninfo[:user] %> password=<%= @passwords[@primary_conninfo[:user]] %>'
112 <% end -%>
113 hot_standby = <%= @settings[:hot_standby] || @defaults[:hot_standby] %>
114 hot_standby_feedback = <%= @settings[:hot_standby_feedback] || @defaults[:hot_standby_feedback] %>
115
116 #------------------------------------------------------------------------------
117 # QUERY TUNING
118 #------------------------------------------------------------------------------
119
120 # - Planner Cost Constants -
121
122 random_page_cost = <%= @settings[:random_page_cost] || @defaults[:random_page_cost] %>
123 cpu_tuple_cost = <%= @settings[:cpu_tuple_cost] || @defaults[:cpu_tuple_cost] %>
124 effective_cache_size = <%= @settings[:effective_cache_size] || @defaults[:effective_cache_size] %>
125
126 # - Other Planner Options -
127
128 default_statistics_target = <%= @settings[:default_statistics_target] || @defaults[:default_statistics_target] %>
129 <% if @version.to_f >= 12 -%>
130 jit = <%= @settings[:jit] || @defaults[:jit] %>
131 <% end -%>
132
133 #------------------------------------------------------------------------------
134 # REPORTING AND LOGGING
135 #------------------------------------------------------------------------------
136
137 # - When to Log -
138
139 log_min_duration_statement = <%= @settings[:log_min_duration_statement] || @defaults[:log_min_duration_statement] %>
140
141 # - What to Log -
142
143 log_line_prefix = '%t '
144
145 #------------------------------------------------------------------------------
146 # RUNTIME STATISTICS
147 #------------------------------------------------------------------------------
148
149 # - Query/Index Statistics Collector -
150
151 track_activity_query_size = <%= @settings[:track_activity_query_size] || @defaults[:track_activity_query_size] %>
152 <% if @version.to_f < 15 -%>
153 stats_temp_directory = '/run/postgresql/<%= @version %>-main.pg_stat_tmp'
154 <% end -%>
155
156 #------------------------------------------------------------------------------
157 # AUTOVACUUM PARAMETERS
158 #------------------------------------------------------------------------------
159
160 log_autovacuum_min_duration = <%= @settings[:log_autovacuum_min_duration] || @defaults[:log_autovacuum_min_duration] %>
161 autovacuum_max_workers = <%= @settings[:autovacuum_max_workers] || @defaults[:autovacuum_max_workers] %>
162 autovacuum_naptime = <%= @settings[:autovacuum_naptime] || @defaults[:autovacuum_naptime] %>
163 autovacuum_vacuum_scale_factor = <%= @settings[:autovacuum_vacuum_scale_factor] || @defaults[:autovacuum_vacuum_scale_factor] %>
164 autovacuum_analyze_scale_factor = <%= @settings[:autovacuum_analyze_scale_factor] || @defaults[:autovacuum_analyze_scale_factor] %>
165 autovacuum_freeze_max_age = <%= @settings[:autovacuum_freeze_max_age] || @defaults[:autovacuum_freeze_max_age] %>
166 autovacuum_multixact_freeze_max_age = <%= @settings[:autovacuum_multixact_freeze_max_age] || @defaults[:autovacuum_multixact_freeze_max_age] %>
167
168 #------------------------------------------------------------------------------
169 # CLIENT CONNECTION DEFAULTS
170 #------------------------------------------------------------------------------
171
172 # - Locale and Formatting -
173
174 datestyle = 'iso, dmy'
175 lc_messages = 'en_GB.UTF-8'
176 lc_monetary = 'en_GB.UTF-8'
177 lc_numeric = 'en_GB.UTF-8'
178 lc_time = 'en_GB.UTF-8'
179 default_text_search_config = 'pg_catalog.english'
180
181 # - Shared Library Preloading -
182
183 shared_preload_libraries = '<%= (@settings[:shared_preload_libraries] || @defaults[:shared_preload_libraries]).sort.join(",") %>'
184
185 #------------------------------------------------------------------------------
186 # LOCK MANAGEMENT
187 #------------------------------------------------------------------------------
188
189 max_locks_per_transaction = <%= @settings[:max_locks_per_transaction] || @defaults[:max_locks_per_transaction] %>
190
191 #------------------------------------------------------------------------------
192 # CUSTOMIZED OPTIONS
193 #------------------------------------------------------------------------------
194
195 <% Hash(@settings[:customized_options]).sort.each do |name, value| -%>
196 <%= name %> = <%= value %>
197 <% end -%>