Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Database configuration of zabbix Monitoring data Storage pg

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. operating system

/ etc/sysctl.conf file is appended as follows:

(sysctl-p makes the configuration effective)

Kernel.shmmni = 4096

Kernel.sem = 50100 64128000 50100 1280

Fs.file-max = 7672460

Net.core.rmem_default = 1048576

Net.core.rmem_max = 4194304

Net.core.wmem_default = 262144

Net.core.wmem_max = 1048576

Net.core.netdev_max_backlog = 10000

Fs.aio-max-nr = 1048576

Net.ipv4.ip_local_port_range = 9000 65000

Net.ipv4.tcp_tw_recycle = 1

Net.ipv4.tcp_max_syn_backlog = 4096

Net.ipv4.tcp_timestamps = 0

Net.ipv4.tcp_keepalive_time=72

Net.ipv4.tcp_keepalive_probes = 9

Net.ipv4.tcp_keepalive_intvl = 7

Vm.overcommit_memory = 0

Vm.swappiness=0

Vm.dirty_background_bytes=102400000

Vm.dirty_bytes=102400000

/ etc/security/limits.conf file is appended as follows:

Soft nofile 131072

Hard nofile 131072

Soft nproc 131072

Hard nproc 131072

Soft core unlimited

Hard core unlimited

Soft memlock 50000000

Hard memlock 50000000

II. Database configuration

Listen_addresses ='*'# what IP address (es) to listen on

Port = 5432 # (change requires restart)

Max_connections = 600 # (change requires restart)

Unix_socket_directories ='.'# comma-separated list of directories

Shared_buffers = 11581MB # min 128kB

Maintenance_work_mem = 2048MB # min 1MB

Dynamic_shared_memory_type = posix # the default is the first option

Shared_preload_libraries = 'pg_stat_statements,pg_pathman' # (change requires restart)

Vacuum_cost_limit = 10000 # 1-10000 credits

Max_worker_processes = 8 # (change requires restart)

Max_parallel_workers_per_gather = 5 # taken from max_worker_processes

Wal_level = logical # minimal, replica, or logical

Synchronous_commit = off # synchronization level

Wal_writer_delay = 500ms # 1-10000 milliseconds

Max_wal_size = 4GB

Min_wal_size = 1GB

Checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0-1.0

Checkpoint_flush_after = 256kB # 0 disables

Archive_mode = on # enables archiving; off, on, or always

Archive_command ='/ bin/date' # command to use to archive a logfile segment

Max_wal_senders = 13 # max number of walsender processes

Wal_keep_segments = 256 # in logfile segments, 16MB each; 0 disables

Hot_standby = on # "on" allows queries during recovery

Random_page_cost = 4 # same scale as above

Log_destination = 'csvlog' # Valid values are combinations of

Logging_collector = on # Enable capturing of stderr and csvlog

Log_directory = 'pg_log' # directory where log files are written

Log_filename = 'postgresql-%a.log' # log filename pattern

Log_truncate_on_rotation = on # If on, an existing log file with the

Log_rotation_age = 1D # Automatic rotation of logfiles will

Log_rotation_size = 10MB # Automatic rotation of logfiles will

Log_min_duration_statement = 100ms #-1 is disabled, 0 logs all statements

Log_timezone = 'PRC'

Autovacuum_naptime = 30s # time between autovacuum runs

Autovacuum_vacuum_scale_factor = 0.02 # fraction of table size before vacuum

Temp_tablespaces = 'tbs_zabbix' # a list of tablespace names,' 'uses

Idle_in_transaction_session_timeout = 7200000 # in milliseconds, 0 is disabled

Datestyle = 'iso, mdy'

Timezone = 'PRC'

Lc_messages = 'en_US.utf8' # locale for system error message

Lc_monetary = 'en_US.utf8' # locale for monetary formatting

Lc_numeric = 'en_US.utf8' # locale for number formatting

Lc_time = 'en_US.utf8' # locale for time formatting

Default_text_search_config = 'pg_catalog.english'

Pg_stat_statements.max = 1000

Pg_stat_statements.track = all

Auth_delay.milliseconds = 5000

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report