配置文件很长,不好管理,一般就是一些主要参数,我们重新组织一下
## Connecting
port = 5432
listen_addresses = '*'
max_connections = 100
ssl = on
## Memory
shared_buffers = 100MB
## Disk
fsync = on
synchronous_commit = on
full_page_writes = on
checkpoint_segments = 3
## PITR
archive_mode = on
archive_command = 'cp %p /usr/local/pgsql/arch/%f;scp %p 218.193.224.22:/usr/local/pgsql/arch_from_11/%f'
archive_timeout = 0
wal_level = hot_standby
max_wal_senders = 1
## Planner
effective_cache_size = 128MB
random_page_cost = 4.0
## Logging
log_destination = 'stderr'
logging_collector = on
log_filename = 'pg%Y-%m-%d_%H%M%S.log'
silent_mode = on
client_min_messages = log
log_min_messages = log
log_truncate_on_rotation = off
log_rotation_age = 1d
log_rotation_size = 10MB
log_min_duration_statement = -1
log_statement = 'none'
log_line_prefix = '%t %u@%d %p'
## Autovacuum
autovacuum = on
autovacuum_vacuum_scale_factor = 0.2
autovacuum_analyze_scale_factor = 0.1
还可以把一些替换参数集合起来,放在一个位置,如文件尾部,用于快速替换这些参数
老外举了一个了例子,在大流量访问的时候以下三个参数关闭,避免影响性能.
## Bulk loading only - leave 'on' for everyday use!
autovacuum = off
fsync = off
full_page_writes = off
遵循后置有效哦,同一参数设置以最后一次出现为准.
而且8.3以后新配置文件中删除了前一次的配置项后reload自动变默认,
以前版本删除了配置文件中某项设置,reload后保持前一设置不变