postgresinator 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 180ee51d22da7db00a45178011dfa845ba7ce1d2
4
+ data.tar.gz: 172dfac2f419d727548f15ecd0a94a0d976cbe1b
5
+ SHA512:
6
+ metadata.gz: c40ee77eaf9ac1d34feee7db9730db38e96ee17c3e6ac23e0ad905d0f0eb0228e6b9d3cd0d20745e7c9f831628e4fc570ebe6cff76564a0418df5663118d2ca4
7
+ data.tar.gz: f5413f940f934dbf83d496b6d0d0bbbbe673010b60b5a6024e15d58da0d4ff8ce71ae06155414255cdac6f27af2e8115e74e05f3ee8d3f1c4b4699433240a781
@@ -0,0 +1,6 @@
1
+ require 'rake'
2
+ require 'sshkit'
3
+ require 'sshkit/dsl'
4
+
5
+ load 'postgresinator/pg.rb'
6
+ load 'postgresinator/config.rb'
@@ -0,0 +1,142 @@
1
+ require 'resolv'
2
+ require 'hashie'
3
+
4
+ namespace :pg do
5
+
6
+ desc 'Write example config files'
7
+ task :write_example_configs do
8
+ run_locally do
9
+ execute "mkdir -p ./templates"
10
+
11
+ # example postgresinator.rb
12
+ config = File.read(File.dirname(__FILE__) + '/examples/postgresinator_example.rb')
13
+ File.open('./postgresinator_example.rb', 'w') { |f| f.write(config) }
14
+ info "Wrote './postgresinator_example.rb'"
15
+ info "Run `mv postgresinator_example.rb postgrestinator.rb` or diff those files and add the needed lines."
16
+
17
+ # example postgresql.conf.erb
18
+ config = File.read(File.dirname(__FILE__) + '/examples/postgresql_example.conf.erb')
19
+ File.open('./templates/postgresql_example.conf.erb', 'w') { |f| f.write(config) }
20
+ info "Wrote './templates/postgres_example.conf.erb'"
21
+ info "Run `mv templates/postgresql_example.conf.erb templates/postgresql.conf.erb` or diff those files and add the needed lines."
22
+
23
+ # example pg_hba.conf.erb
24
+ config = File.read(File.dirname(__FILE__) + '/examples/pg_hba_example.conf.erb')
25
+ File.open('./templates/pg_hba_example.conf.erb', 'w') { |f| f.write(config) }
26
+ info "Wrote './templates/pg_hba_example.conf.erb'"
27
+ info "Run `mv templates/pg_hba_example.conf.erb templates/pg_hba.conf.erb` or diff those files and add the needed lines."
28
+
29
+ # example recovery.conf.erb
30
+ config = File.read(File.dirname(__FILE__) + '/examples/recovery_example.conf.erb')
31
+ File.open('./templates/recovery_example.conf.erb', 'w') { |f| f.write(config) }
32
+ info "Wrote './templates/recovery_example.conf.erb'"
33
+ info "Run `mv templates/recovery_example.conf.erb templates/recovery.conf.erb` or diff those files and add the needed lines."
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ namespace :config do
40
+
41
+ task :load_settings do
42
+ cluster = Hashie::Mash.new(PostgresCluster.settings)
43
+ cluster.ssh_user = ENV["USER"]
44
+ cluster.servers.each do |server|
45
+ server.ip = Resolv.getaddress(server.domain)
46
+ server.master_or_slave = server.master ? "master" : "slave"
47
+ server.master_domain = cluster.servers.collect { |s| s.domain if s.master }.first
48
+ server.master_ip = Resolv.getaddress(server.master_domain)
49
+ server.master_port = cluster.servers.collect { |s| s.port if s.master }.first
50
+ server.container_name = "#{server.master_domain}-postgres-#{server.port}-#{server.master_or_slave}"
51
+ server.data_path = "/#{server.container_name}-data"
52
+ server.conf_path = "/#{server.container_name}-conf"
53
+ server.docker_run_command = [
54
+ "--detach", "--tty", "--user", "postgres",
55
+ "--name", server.container_name,
56
+ "--volume", cluster.image.sock_path,
57
+ "--volume", "#{server.data_path}:#{cluster.image.data_path}:rw",
58
+ "--volume", "#{server.conf_path}:#{cluster.image.conf_path}:rw",
59
+ "--expose", "5432",
60
+ "--publish", "0.0.0.0:#{server.port}:5432",
61
+ cluster.image.name
62
+ ]
63
+ server.docker_init_command = [
64
+ "--rm", "--user", "root",
65
+ "--volume", "#{server.data_path}:/postgresql-data:rw",
66
+ "--entrypoint", "/usr/bin/rsync",
67
+ cluster.image.name, "-ah", "#{cluster.image.data_path}/", "/postgresql-data/"
68
+ ]
69
+ server.docker_replicate_command = [
70
+ "--rm", "--user", "postgres",
71
+ "--volume", "#{server.data_path}:#{cluster.image.data_path}:rw",
72
+ "--entrypoint", "/usr/bin/pg_basebackup",
73
+ cluster.image.name,
74
+ "-w", "-h", server.master_domain, "-p", server.master_port,
75
+ "-U", "replicator", "-D", cluster.image.data_path, "-v", "-x"
76
+ ]
77
+ end
78
+ @cluster = cluster
79
+ end
80
+
81
+ task :ensure_cluster_data_uniqueness => :load_settings do
82
+ cluster = @cluster
83
+ run_locally do
84
+ names = cluster.servers.collect { |s| s.container_name }
85
+ fatal "The container names in this cluster are not unique" and raise unless names == names.uniq
86
+
87
+ masters = cluster.servers.collect { |s| s.domain if s.master }
88
+ fatal "You can't set more than one master" and raise unless masters.compact.length == 1
89
+ end
90
+ end
91
+
92
+ task :config_file_not_found, [:config_file] do |t, args|
93
+ cluster = @cluster
94
+ run_locally do
95
+ config_file_found = false
96
+ cluster.image.config_files.each do |config_file|
97
+ next unless config_file == args.config_file
98
+ config_file_found = true
99
+ end
100
+ fatal "Config file #{args.config_file} not found in the configuration" and raise unless config_file_found
101
+ config_template_found = test("ls", "-A", "templates/#{args.config_file}.erb")
102
+ fatal "Config template file templates/#{args.config_file}.erb not found locally" and raise unless config_template_found
103
+ end
104
+ end
105
+
106
+ task :database_not_found, [:database_name] do |t, args|
107
+ cluster = @cluster
108
+ run_locally do
109
+ database_found = false
110
+ cluster.databases.each do |database|
111
+ next unless database.name == args.database_name
112
+ database_found = true
113
+ end
114
+ fatal "Database #{args.domain} not found in the configuration" and raise unless database_found
115
+ end
116
+ end
117
+
118
+ task :domain_not_found, [:domain] do |t, args|
119
+ cluster = @cluster
120
+ run_locally do
121
+ domain_found = false
122
+ cluster.servers.each do |server|
123
+ next unless server.domain == args.domain
124
+ domain_found = true
125
+ end
126
+ fatal "Server domain #{args.domain} not found in the configuration" and raise unless domain_found
127
+ end
128
+ end
129
+
130
+ task :role_not_found, [:role_name] do |t, args|
131
+ cluster = @cluster
132
+ run_locally do
133
+ role_found = false
134
+ cluster.databases.each do |database|
135
+ next unless database.role == args.role_name
136
+ role_found = true
137
+ end
138
+ fatal "Role #{args.role_name} not found in the configuration" and raise unless role_found
139
+ end
140
+ end
141
+
142
+ end
@@ -0,0 +1,92 @@
1
+ # PostgreSQL Client Authentication Configuration File
2
+ # ===================================================
3
+ #
4
+ # Refer to the "Client Authentication" section in the
5
+ # PostgreSQL documentation for a complete description
6
+ # of this file. A short synopsis follows.
7
+ #
8
+ # This file controls: which hosts are allowed to connect, how clients
9
+ # are authenticated, which PostgreSQL user names they can use, which
10
+ # databases they can access. Records take one of these forms:
11
+ #
12
+ # local DATABASE USER METHOD [OPTION]
13
+ # host DATABASE USER CIDR-ADDRESS METHOD [OPTION]
14
+ # hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
15
+ # hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
16
+ #
17
+ # (The uppercase items must be replaced by actual values.)
18
+ #
19
+ # The first field is the connection type: "local" is a Unix-domain socket,
20
+ # "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
21
+ # SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
22
+ #
23
+ # DATABASE can be "all", "sameuser", "samerole", a database name, or
24
+ # a comma-separated list thereof.
25
+ #
26
+ # USER can be "all", a user name, a group name prefixed with "+", or
27
+ # a comma-separated list thereof. In both the DATABASE and USER fields
28
+ # you can also write a file name prefixed with "@" to include names from
29
+ # a separate file.
30
+ #
31
+ # CIDR-ADDRESS specifies the set of hosts the record matches.
32
+ # It is made up of an IP address and a CIDR mask that is an integer
33
+ # (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
34
+ # the number of significant bits in the mask. Alternatively, you can write
35
+ # an IP address and netmask in separate columns to specify the set of hosts.
36
+ #
37
+ # METHOD can be "trust", "reject", "md5", "crypt", "password", "gss", "sspi",
38
+ # "krb5", "ident", "pam" or "ldap". Note that "password" sends passwords
39
+ # in clear text; "md5" is preferred since it sends encrypted passwords.
40
+ #
41
+ # OPTION is the ident map or the name of the PAM service, depending on METHOD.
42
+ #
43
+ # Database and user names containing spaces, commas, quotes and other special
44
+ # characters must be quoted. Quoting one of the keywords "all", "sameuser" or
45
+ # "samerole" makes the name lose its special character, and just match a
46
+ # database or username with that name.
47
+ #
48
+ # This file is read on server startup and when the postmaster receives
49
+ # a SIGHUP signal. If you edit the file on a running system, you have
50
+ # to SIGHUP the postmaster for the changes to take effect. You can use
51
+ # "pg_ctl reload" to do that.
52
+
53
+ # Put your actual configuration here
54
+ # ----------------------------------
55
+ #
56
+ # If you want to allow non-local connections, you need to add more
57
+ # "host" records. In that case you will also need to make PostgreSQL listen
58
+ # on a non-local interface via the listen_addresses configuration parameter,
59
+ # or via the -i or -h command line switches.
60
+ #
61
+
62
+
63
+
64
+
65
+ # DO NOT DISABLE!
66
+ # If you change this first entry you will need to make sure that the
67
+ # database
68
+ # super user can access the database using some other method.
69
+ # Noninteractive
70
+ # access to all databases is required during automatic maintenance
71
+ # (autovacuum, daily cronjob, replication, and similar tasks).
72
+ #
73
+ # Database administrative login by UNIX sockets
74
+ local all postgres ident
75
+
76
+ # TYPE DATABASE USER CIDR-ADDRESS METHOD
77
+ <% if @server.master %>
78
+ <% @cluster.servers.each do |server| %>
79
+ <% unless server.master %>
80
+ hostssl replication replicator <%= server.ip %>/32 trust
81
+ <% end %>
82
+ <% end %>
83
+ <% end %>
84
+ host all postgres 172.16.0.0/12 trust # allow docker IPs for localhost access on the host
85
+ host all all 172.16.0.0/12 md5
86
+
87
+ # "local" is for Unix domain socket connections only
88
+ local all all ident
89
+ # IPv4 local connections:
90
+ host all all 127.0.0.1/32 md5
91
+ # IPv6 local connections:
92
+ host all all ::1/128 md5
@@ -0,0 +1,35 @@
1
+ class PostgresCluster
2
+ def self.settings
3
+ {
4
+ "image" => {
5
+ "name" => "snarlysodboxer/postgresql:0.0.0",
6
+ "config_files" => ["postgresql.conf", "pg_hba.conf", "recovery.conf"],
7
+ "data_path" => "/var/lib/postgresql/9.1/main",
8
+ "conf_path" => "/etc/postgresql/9.1/main",
9
+ "sock_path" => "/var/run/postgresql",
10
+ "postgres_uid" => "101",
11
+ "postgres_gid" => "104"
12
+
13
+ },
14
+ "databases" => [
15
+ {
16
+ "name" => "client",
17
+ "role" => "client",
18
+ "pass" => "client"
19
+ }
20
+ ],
21
+ "servers" => [
22
+ {
23
+ "master" => true,
24
+ "domain" => "client.example.com",
25
+ "port" => "5432"
26
+ },
27
+ {
28
+ "master" => false,
29
+ "domain" => "client-other.example.com",
30
+ "port" => "5433"
31
+ }
32
+ ]
33
+ }
34
+ end
35
+ end
@@ -0,0 +1,498 @@
1
+ # -----------------------------
2
+ # PostgreSQL configuration file
3
+ # -----------------------------
4
+ #
5
+ # This file consists of lines of the form:
6
+ #
7
+ # name = value
8
+ #
9
+ # (The "=" is optional.) Whitespace may be used. Comments are introduced with
10
+ # "#" anywhere on a line. The complete list of parameter names and allowed
11
+ # values can be found in the PostgreSQL documentation.
12
+ #
13
+ # The commented-out settings shown in this file represent the default values.
14
+ # Re-commenting a setting is NOT sufficient to revert it to the default value;
15
+ # you need to reload the server.
16
+ #
17
+ # This file is read on server startup and when the server receives a SIGHUP
18
+ # signal. If you edit the file on a running system, you have to SIGHUP the
19
+ # server for the changes to take effect, or use "pg_ctl reload". Some
20
+ # parameters, which are marked below, require a server shutdown and restart to
21
+ # take effect.
22
+ #
23
+ # Any parameter can also be given as a command-line option to the server, e.g.,
24
+ # "postgres -c log_connections=on". Some paramters can be changed at run time
25
+ # with the "SET" SQL command.
26
+ #
27
+ # Memory units: kB = kilobytes MB = megabytes GB = gigabytes
28
+ # Time units: ms = milliseconds s = seconds min = minutes h = hours d = days
29
+
30
+ #------------------------------------------------------------------------------
31
+ # FILE LOCATIONS
32
+ #------------------------------------------------------------------------------
33
+
34
+ # The default values of these variables are driven from the -D command-line
35
+ # option or PGDATA environment variable, represented here as ConfigDir.
36
+
37
+ data_directory = '<%= @cluster.image.data_path %>' # use data in another directory
38
+ # (change requires restart)
39
+ hba_file = '<%= @cluster.image.conf_path %>/pg_hba.conf' # host-based authentication file
40
+ # (change requires restart)
41
+ ident_file = '<%= @cluster.image.conf_path %>/pg_ident.conf' # ident configuration file
42
+ # (change requires restart)
43
+
44
+ # If external_pid_file is not explicitly set, no extra PID file is written.
45
+ external_pid_file = '/var/run/postgresql/9.1-main.pid' # write an extra PID file
46
+ # (change requires restart)
47
+
48
+ #------------------------------------------------------------------------------
49
+ # CONNECTIONS AND AUTHENTICATION
50
+ #------------------------------------------------------------------------------
51
+
52
+ # - Connection Settings -
53
+
54
+ listen_addresses = '*' # what IP address(es) to listen on;
55
+ # comma-separated list of addresses;
56
+ # defaults to 'localhost', '*' = all
57
+ # (change requires restart)
58
+ wal_level = hot_standby
59
+ max_wal_senders = 3
60
+ checkpoint_segments = 8
61
+ wal_keep_segments = 8
62
+ <% unless @server.master %>
63
+ hot_standby = on
64
+ <% end %>
65
+ port = 5432 # (change requires restart)
66
+ max_connections = 100 # (change requires restart)
67
+ # Note: Increasing max_connections costs ~400 bytes of shared memory per
68
+ # connection slot, plus lock space (see max_locks_per_transaction). You might
69
+ # also need to raise shared_buffers to support more connections.
70
+ #superuser_reserved_connections = 3 # (change requires restart)
71
+ unix_socket_directory = '/var/run/postgresql' # (change requires restart)
72
+ #unix_socket_group = '' # (change requires restart)
73
+ #unix_socket_permissions = 0777 # begin with 0 to use octal notation
74
+ # (change requires restart)
75
+ #bonjour_name = '' # defaults to the computer name
76
+ # (change requires restart)
77
+
78
+ # - Security and Authentication -
79
+
80
+ #authentication_timeout = 1min # 1s-600s
81
+ ssl = true # (change requires restart)
82
+ #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
83
+ # (change requires restart)
84
+ #password_encryption = on
85
+ #db_user_namespace = off
86
+
87
+ # Kerberos and GSSAPI
88
+ #krb_server_keyfile = '' # (change requires restart)
89
+ #krb_srvname = 'postgres' # (change requires restart, Kerberos only)
90
+ #krb_server_hostname = '' # empty string matches any keytab entry
91
+ # (change requires restart, Kerberos only)
92
+ #krb_caseins_users = off # (change requires restart)
93
+ #krb_realm = '' # (change requires restart)
94
+
95
+ # - TCP Keepalives -
96
+ # see "man 7 tcp" for details
97
+
98
+ #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
99
+ # 0 selects the system default
100
+ #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
101
+ # 0 selects the system default
102
+ #tcp_keepalives_count = 0 # TCP_KEEPCNT;
103
+ # 0 selects the system default
104
+
105
+
106
+ #------------------------------------------------------------------------------
107
+ # RESOURCE USAGE (except WAL)
108
+ #------------------------------------------------------------------------------
109
+
110
+ # - Memory -
111
+
112
+ shared_buffers = 24MB # min 128kB or max_connections*16kB
113
+ # (change requires restart)
114
+ #temp_buffers = 8MB # min 800kB
115
+ #max_prepared_transactions = 5 # can be 0 or more
116
+ # (change requires restart)
117
+ # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
118
+ # per transaction slot, plus lock space (see max_locks_per_transaction).
119
+ #work_mem = 1MB # min 64kB
120
+ #maintenance_work_mem = 16MB # min 1MB
121
+ #max_stack_depth = 2MB # min 100kB
122
+
123
+ # - Free Space Map -
124
+
125
+ #max_fsm_pages = 153600 # min max_fsm_relations*16, 6 bytes each
126
+ # (change requires restart)
127
+ #max_fsm_relations = 1000 # min 100, ~70 bytes each
128
+ # (change requires restart)
129
+
130
+ # - Kernel Resource Usage -
131
+
132
+ #max_files_per_process = 1000 # min 25
133
+ # (change requires restart)
134
+ #shared_preload_libraries = '' # (change requires restart)
135
+
136
+ # - Cost-Based Vacuum Delay -
137
+
138
+ #vacuum_cost_delay = 0 # 0-1000 milliseconds
139
+ #vacuum_cost_page_hit = 1 # 0-10000 credits
140
+ #vacuum_cost_page_miss = 10 # 0-10000 credits
141
+ #vacuum_cost_page_dirty = 20 # 0-10000 credits
142
+ #vacuum_cost_limit = 200 # 1-10000 credits
143
+
144
+ # - Background Writer -
145
+
146
+ #bgwriter_delay = 200ms # 10-10000ms between rounds
147
+ #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
148
+ #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
149
+
150
+
151
+ #------------------------------------------------------------------------------
152
+ # WRITE AHEAD LOG
153
+ #------------------------------------------------------------------------------
154
+
155
+ # - Settings -
156
+
157
+ #fsync = on # turns forced synchronization on or off
158
+ #synchronous_commit = on # immediate fsync at commit
159
+ #wal_sync_method = fsync # the default is the first option
160
+ # supported by the operating system:
161
+ # open_datasync
162
+ # fdatasync
163
+ # fsync
164
+ # fsync_writethrough
165
+ # open_sync
166
+ #full_page_writes = on # recover from partial page writes
167
+ #wal_buffers = 64kB # min 32kB
168
+ # (change requires restart)
169
+ #wal_writer_delay = 200ms # 1-10000 milliseconds
170
+
171
+ #commit_delay = 0 # range 0-100000, in microseconds
172
+ #commit_siblings = 5 # range 1-1000
173
+
174
+ # - Checkpoints -
175
+
176
+ #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
177
+ #checkpoint_timeout = 5min # range 30s-1h
178
+ #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
179
+ #checkpoint_warning = 30s # 0 is off
180
+
181
+ # - Archiving -
182
+
183
+ #archive_mode = off # allows archiving to be done
184
+ # (change requires restart)
185
+ #archive_command = '' # command to use to archive a logfile segment
186
+ #archive_timeout = 0 # force a logfile segment switch after this
187
+ # time; 0 is off
188
+
189
+
190
+ #------------------------------------------------------------------------------
191
+ # QUERY TUNING
192
+ #------------------------------------------------------------------------------
193
+
194
+ # - Planner Method Configuration -
195
+
196
+ #enable_bitmapscan = on
197
+ #enable_hashagg = on
198
+ #enable_hashjoin = on
199
+ #enable_indexscan = on
200
+ #enable_mergejoin = on
201
+ #enable_nestloop = on
202
+ #enable_seqscan = on
203
+ #enable_sort = on
204
+ #enable_tidscan = on
205
+
206
+ # - Planner Cost Constants -
207
+
208
+ #seq_page_cost = 1.0 # measured on an arbitrary scale
209
+ #random_page_cost = 4.0 # same scale as above
210
+ #cpu_tuple_cost = 0.01 # same scale as above
211
+ #cpu_index_tuple_cost = 0.005 # same scale as above
212
+ #cpu_operator_cost = 0.0025 # same scale as above
213
+ #effective_cache_size = 128MB
214
+
215
+ # - Genetic Query Optimizer -
216
+
217
+ #geqo = on
218
+ #geqo_threshold = 12
219
+ #geqo_effort = 5 # range 1-10
220
+ #geqo_pool_size = 0 # selects default based on effort
221
+ #geqo_generations = 0 # selects default based on effort
222
+ #geqo_selection_bias = 2.0 # range 1.5-2.0
223
+
224
+ # - Other Planner Options -
225
+
226
+ #default_statistics_target = 10 # range 1-1000
227
+ #constraint_exclusion = off
228
+ #from_collapse_limit = 8
229
+ #join_collapse_limit = 8 # 1 disables collapsing of explicit
230
+ # JOIN clauses
231
+
232
+
233
+ #------------------------------------------------------------------------------
234
+ # ERROR REPORTING AND LOGGING
235
+ #------------------------------------------------------------------------------
236
+
237
+ # - Where to Log -
238
+
239
+ #log_destination = 'stderr' # Valid values are combinations of
240
+ # stderr, csvlog, syslog and eventlog,
241
+ # depending on platform. csvlog
242
+ # requires logging_collector to be on.
243
+
244
+ # This is used when logging to stderr:
245
+ #logging_collector = off # Enable capturing of stderr and csvlog
246
+ # into log files. Required to be on for
247
+ # csvlogs.
248
+ # (change requires restart)
249
+
250
+ # These are only used if logging_collector is on:
251
+ #log_directory = 'pg_log' # directory where log files are written,
252
+ # can be absolute or relative to PGDATA
253
+ #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
254
+ # can include strftime() escapes
255
+ #log_truncate_on_rotation = off # If on, an existing log file of the
256
+ # same name as the new log file will be
257
+ # truncated rather than appended to.
258
+ # But such truncation only occurs on
259
+ # time-driven rotation, not on restarts
260
+ # or size-driven rotation. Default is
261
+ # off, meaning append to existing files
262
+ # in all cases.
263
+ #log_rotation_age = 1d # Automatic rotation of logfiles will
264
+ # happen after that time. 0 to disable.
265
+ #log_rotation_size = 10MB # Automatic rotation of logfiles will
266
+ # happen after that much log output.
267
+ # 0 to disable.
268
+
269
+ # These are relevant when logging to syslog:
270
+ #syslog_facility = 'LOCAL0'
271
+ #syslog_ident = 'postgres'
272
+
273
+
274
+ # - When to Log -
275
+
276
+ #client_min_messages = notice # values in order of decreasing detail:
277
+ # debug5
278
+ # debug4
279
+ # debug3
280
+ # debug2
281
+ # debug1
282
+ # log
283
+ # notice
284
+ # warning
285
+ # error
286
+
287
+ #log_min_messages = notice # values in order of decreasing detail:
288
+ # debug5
289
+ # debug4
290
+ # debug3
291
+ # debug2
292
+ # debug1
293
+ # info
294
+ # notice
295
+ # warning
296
+ # error
297
+ # log
298
+ # fatal
299
+ # panic
300
+
301
+ #log_error_verbosity = default # terse, default, or verbose messages
302
+
303
+ #log_min_error_statement = error # values in order of decreasing detail:
304
+ # debug5
305
+ # debug4
306
+ # debug3
307
+ # debug2
308
+ # debug1
309
+ # info
310
+ # notice
311
+ # warning
312
+ # error
313
+ # log
314
+ # fatal
315
+ # panic (effectively off)
316
+
317
+ #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
318
+ # and their durations, > 0 logs only
319
+ # statements running at least this time.
320
+
321
+ #silent_mode = off # DO NOT USE without syslog or
322
+ # logging_collector
323
+ # (change requires restart)
324
+
325
+ # - What to Log -
326
+
327
+ #debug_print_parse = off
328
+ #debug_print_rewritten = off
329
+ #debug_print_plan = off
330
+ #debug_pretty_print = off
331
+ #log_checkpoints = off
332
+ #log_connections = off
333
+ #log_disconnections = off
334
+ #log_duration = off
335
+ #log_hostname = off
336
+ log_line_prefix = '%t ' # special values:
337
+ # %u = user name
338
+ # %d = database name
339
+ # %r = remote host and port
340
+ # %h = remote host
341
+ # %p = process ID
342
+ # %t = timestamp without milliseconds
343
+ # %m = timestamp with milliseconds
344
+ # %i = command tag
345
+ # %c = session ID
346
+ # %l = session line number
347
+ # %s = session start timestamp
348
+ # %v = virtual transaction ID
349
+ # %x = transaction ID (0 if none)
350
+ # %q = stop here in non-session
351
+ # processes
352
+ # %% = '%'
353
+ # e.g. '<%u%%%d> '
354
+ #log_lock_waits = off # log lock waits >= deadlock_timeout
355
+ #log_statement = 'none' # none, ddl, mod, all
356
+ #log_temp_files = -1 # log temporary files equal or larger
357
+ # than specified size;
358
+ # -1 disables, 0 logs all temp files
359
+ #log_timezone = unknown # actually, defaults to TZ environment
360
+ # setting
361
+
362
+
363
+ #------------------------------------------------------------------------------
364
+ # RUNTIME STATISTICS
365
+ #------------------------------------------------------------------------------
366
+
367
+ # - Query/Index Statistics Collector -
368
+
369
+ #track_activities = on
370
+ #track_counts = on
371
+ #update_process_title = on
372
+
373
+
374
+ # - Statistics Monitoring -
375
+
376
+ #log_parser_stats = off
377
+ #log_planner_stats = off
378
+ #log_executor_stats = off
379
+ #log_statement_stats = off
380
+
381
+
382
+ #------------------------------------------------------------------------------
383
+ # AUTOVACUUM PARAMETERS
384
+ #------------------------------------------------------------------------------
385
+
386
+ #autovacuum = on # Enable autovacuum subprocess? 'on'
387
+ # requires track_counts to also be on.
388
+ #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
389
+ # their durations, > 0 logs only
390
+ # actions running at least that time.
391
+ #autovacuum_max_workers = 3 # max number of autovacuum subprocesses
392
+ #autovacuum_naptime = 1min # time between autovacuum runs
393
+ #autovacuum_vacuum_threshold = 50 # min number of row updates before
394
+ # vacuum
395
+ #autovacuum_analyze_threshold = 50 # min number of row updates before
396
+ # analyze
397
+ #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
398
+ #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
399
+ #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
400
+ # (change requires restart)
401
+ #autovacuum_vacuum_cost_delay = 20 # default vacuum cost delay for
402
+ # autovacuum, -1 means use
403
+ # vacuum_cost_delay
404
+ #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
405
+ # autovacuum, -1 means use
406
+ # vacuum_cost_limit
407
+
408
+
409
+ #------------------------------------------------------------------------------
410
+ # CLIENT CONNECTION DEFAULTS
411
+ #------------------------------------------------------------------------------
412
+
413
+ # - Statement Behavior -
414
+
415
+ #search_path = '"$user",public' # schema names
416
+ #default_tablespace = '' # a tablespace name, '' uses the default
417
+ #temp_tablespaces = '' # a list of tablespace names, '' uses
418
+ # only default tablespace
419
+ #check_function_bodies = on
420
+ #default_transaction_isolation = 'read committed'
421
+ #default_transaction_read_only = off
422
+ #session_replication_role = 'origin'
423
+ #statement_timeout = 0 # 0 is disabled
424
+ #vacuum_freeze_min_age = 100000000
425
+ #xmlbinary = 'base64'
426
+ #xmloption = 'content'
427
+
428
+ # - Locale and Formatting -
429
+
430
+ datestyle = 'iso, mdy'
431
+ #timezone = unknown # actually, defaults to TZ environment
432
+ # setting
433
+ #timezone_abbreviations = 'Default' # Select the set of available time zone
434
+ # abbreviations. Currently, there are
435
+ # Default
436
+ # Australia
437
+ # India
438
+ # You can create your own file in
439
+ # share/timezonesets/.
440
+ #extra_float_digits = 0 # min -15, max 2
441
+ #client_encoding = sql_ascii # actually, defaults to database
442
+ # encoding
443
+
444
+ # These settings are initialized by initdb, but they can be changed.
445
+ #lc_messages = 'en_US.UTF-8' # locale for system error message
446
+ # strings
447
+ #lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
448
+ #lc_numeric = 'en_US.UTF-8' # locale for number formatting
449
+ #lc_time = 'en_US.UTF-8' # locale for time formatting
450
+
451
+ # default configuration for text search
452
+ default_text_search_config = 'pg_catalog.english'
453
+
454
+ # - Other Defaults -
455
+
456
+ #explain_pretty_print = on
457
+ #dynamic_library_path = '$libdir'
458
+ #local_preload_libraries = ''
459
+
460
+
461
+ #------------------------------------------------------------------------------
462
+ # LOCK MANAGEMENT
463
+ #------------------------------------------------------------------------------
464
+
465
+ #deadlock_timeout = 1s
466
+ #max_locks_per_transaction = 64 # min 10
467
+ # (change requires restart)
468
+ # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
469
+ # max_locks_per_transaction * (max_connections + max_prepared_transactions)
470
+ # lock table slots.
471
+
472
+
473
+ #------------------------------------------------------------------------------
474
+ # VERSION/PLATFORM COMPATIBILITY
475
+ #------------------------------------------------------------------------------
476
+
477
+ # - Previous PostgreSQL Versions -
478
+
479
+ #add_missing_from = off
480
+ #array_nulls = on
481
+ #backslash_quote = safe_encoding # on, off, or safe_encoding
482
+ #default_with_oids = off
483
+ #escape_string_warning = on
484
+ #regex_flavor = advanced # advanced, extended, or basic
485
+ #sql_inheritance = on
486
+ #standard_conforming_strings = off
487
+ #synchronize_seqscans = on
488
+
489
+ # - Other Platforms and Clients -
490
+
491
+ #transform_null_equals = off
492
+
493
+
494
+ #------------------------------------------------------------------------------
495
+ # CUSTOMIZED OPTIONS
496
+ #------------------------------------------------------------------------------
497
+
498
+ #custom_variable_classes = '' # list of custom variable class names