人大金仓数据库参数优化
#基础配置
max_connections=2000 #按项目需求配置
shared_buffers = 4GB #RAM*25%
effective_cache_size = 8GB #RAM*50%
maintenance_work_mem = 2GB
work_mem = 10MB
max_wal_size = 2GB
min_wal_size = 1GB
wal_keep_segments = 512
max_wal_senders = 32
max_replication_slots = 32
hot_standby_feedback = on
wal_log_hints = on
wal_compression = on
synchronous_commit = remote_apply #读写分离集群必须配置remote_apply, 主备集群优先配置synchronous_commit = on;
checkpoint_timeout = 5min
checkpoint_completion_target = 0.5
max_locks_per_transaction = 1024
log_replication_commands = on
log_filename = 'kingbase-%Y-%m-%d.log' #在测试时建议配置'kingbase-%Y-%m-%d_%H.log',生产环境建议配置成'kingbase-%d.log',一个月30天,一天一个日志会自动循环;
log_truncate_on_rotation = on
log_statement = 'none'
#kbbadger分析日志需要参数
log_min_duration_statement = 2000 #测试时建议配置0,生产系统建议配置2000;
log_line_prefix='%t[%p]:[%l-1] user=%u,db=%d,app=%a,client=%h,[%e]'
log_checkpoints = on
log_connections = on #
log_disconnections = on #
log_lock_waits = on
log_temp_files = 0
log_autovacuum_min_duration = 0
log_error_verbosity = default
log_destination='stderr'
lc_messages='C'
#KWR统计信息
track_sql = on
track_instance = on
track_wait_timing = on
track_counts = on
track_io_timing = on
track_functions = 'all'
sys_stat_statements.track = 'top'
sys_stat_statements.max = 10000
sys_kwr.enable = on