Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Subdirectories under /var/run/ do not persist across reboots.

  • Loading branch information...
commit e8395fe20b284c14fae0d072c8437633f42fd8fa 1 parent 0756507
@wayneeseguin wayneeseguin authored
View
2  pgbouncer/bin/configure
@@ -1,7 +1,7 @@
#!/bin/sh
paths create owner "${service_user:-"postgres"}" \
- "/etc/pgbouncer" "/var/log/pgbouncer" "/var/run/pgbouncer"
+ "/etc/pgbouncer" "/var/log/pgbouncer"
for template in pgbouncer.ini userlist.txt
do
View
2  pgpool/shell/functions
@@ -124,7 +124,7 @@ pgpool_defaults()
string "pgpool/syslog_facility" default "LOCAL0" as "syslog_facility" \
string "pgpool/syslog_ident" default "pgpool" as "syslog_ident" \
string "pgpool/debug_level" default "0" as "debug_level" \
- string "pgpool/status_path" default "/var/run/pgpool" as "status_path" \
+ string "pgpool/status_path" default "/var/run" as "status_path" \
string "pgpool/connection_cache" default "on" as "connection_cache" \
string "pgpool/reset_query_list" default "ABORT; DISCARD ALL" as "reset_query_list" \
string "pgpool/replication_mode" default "off" as "replication_mode" \
View
5 postgresql/bin/configure
@@ -5,11 +5,12 @@ user is root || log error "'postgresql configure system' may only be run as root
if ! path exists "${service_data_path}/base"
then log error "Database must be initialized before configuration may be done: 'postgresql initialize'" ; fi
-paths create "/etc/postgresql/" "/var/log/postgresql" "/var/run/postgresql" \
- "/var/db/postgresql"
+paths create "/etc/postgresql/" "/var/log/postgresql" "/var/db/postgresql"
user create unless exists system name "${service_user}" home "${service_db_path}"
+postgresql_configure_shm
+
template install "postgresql/postgresql.conf" \
to "${service_data_path}/postgresql.conf" \
mode 0644 \
View
44 postgresql/shell/functions
@@ -98,7 +98,7 @@ postgresql_defaults()
string "postgresql/max/slow" default 1024 as "max_slow" \
string "postgresql/log/slow" default 10000 as "log_slow" \
string "postgresql/service/bin_path" as "service_bin_path" default "${sm_path}/pkg/versions/postgresql/${package_version}/bin" \
- string "postgresql/service/pid_file" as "service_pid_file" default "/var/run/postgresql/postgresql.pid" \
+ string "postgresql/service/pid_file" as "service_pid_file" default "/var/run/postgresql.pid" \
string "postgresql/service/config_file" as "service_config_file" default "/etc/postgresql/postgresql.conf" \
string "postgresql/service/log_file" as "service_log_file" default "/var/log/postgresql/postgresql.log" \
string "postgresql/service/user" as "service_user" default "${service_user}" \
@@ -112,7 +112,8 @@ postgresql_defaults()
string "postgresql/wal/keep_segments" as "wal_keep_segments" default "20" \
string "postgresql/checkpoint/segments" as "checkpoint_segments" default "100" \
string "postgresql/effective_cache_size" as "effective_cache_size" default "512MB" \
- string "postgresql/shared_buffers" as "shared_buffers" default "1GB"
+ string "postgresql/shared_buffers" as "shared_buffers" default "1GB" \
+ string "postgresql/unix_socket_directory" as "unix_socket_directory" default "/tmp"
PGDATA="${service_data_path}"
}
@@ -235,3 +236,42 @@ postgresql_uninstall()
log "Removal of ${package_name} complete."
}
+postgresql_configure_shm()
+{
+
+ # Full memory requirement calculations:
+ # typeset max_locks_per_transaction max_connections autovacuum_max_workers \
+ # max_prepared_transactions block_size wal_block_size wal_buffers
+
+ # Defaults:
+ # max_locks_per_transaction=64
+ # max_connections=100
+ # autovacuum_max_workers=3
+ # max_prepared_transactions=0
+ # block_size=8192
+ # wal_block_size=8192
+ # wal_buffers=8
+
+ # Formulas:
+ # connections=$(expr (1800 + 270 \* ${max_locks_per_transaction}) \* (${max_connections} + ${autovacuum_max_workers}))
+ # prepared_transactions=$(expr (770 + 270 \* ${max_locks_per_transaction}) \* ${max_prepared_transactions})
+ # shared_disk_buffers=$(expr (${block_size} + 208) \* ${shared_buffers})
+ # total_wal_buffers=$(expr (${wal_block_size} + 8) \* ${wal_buffers})
+ # fixed_space_requirements=770 # kB
+
+ if command exists getconf
+ then # setup shm using getconf
+ typeset page_size physical_pages
+ page_size=$(getconf PAGE_SIZE)
+ physical_pages=$(getconf _PHYS_PAGES)
+ shmall=$(${physical_pages}/2)
+ shmmax=$(expr ${shmall} \* ${page_size})
+ if ! file contains string 'kernel.shmmax' /etc/sysctl.conf
+ then file write append string "kernel.shmmax = ${shmmax}\n" to /etc/sysctl.conf
+ fi
+ if ! file contains string 'kernel.shmall' /etc/sysctl.conf
+ then file write append string "kernel.shmall = ${shmall}\n" to /etc/sysctl.conf
+ fi
+ sysctl -p /etc/sysctl.conf
+ fi
+}
View
4 postgresql/templates/postgresql.conf
@@ -356,7 +356,7 @@ log_min_duration_statement = 2000
log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
-log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d %r'
+log_line_prefix = '%t:%r:%u@%d:%c:[%l-1]:[%p]:%a: ''
#log_line_prefix = '' # special values:
# %a = application name
# %u = user name
@@ -378,7 +378,7 @@ log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d %r'
# %% = '%'
# e.g. '<%u%%%d> '
#log_lock_waits = off # log lock waits >= deadlock_timeout
-log_statement = 'none' # none, ddl, mod, all
+log_statement = 'ddl' # none, ddl, mod, all
#log_temp_files = -1 # log temporary files equal or larger
# than the specified size in kilobytes;
# -1 disables, 0 logs all temp files
Please sign in to comment.
Something went wrong with that request. Please try again.