原作者:杨文可
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
# values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default values.
# Re-commenting a setting is NOT sufficient to revert it to the default value;
# you need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# signal. If you edit the file on a running system, you have to SIGHUP the
# server for the changes to take effect, or use "pg_ctl reload". Some
# parameters, which are marked below, require a server shutdown and restart to
# take effect.
#
# Any parameter can also be given as a command-line option to the server, e.g.,
# "postgres -c log_connections=on". Some parameters can be changed at run time
# with the "SET" SQL command.
#
# Memory units: kB = kilobytes Time units: ms = milliseconds
# MB = megabytes s = seconds
# GB = gigabytes min = minutes
# h = hours
# d = days
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
# (change requires restart)
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
# (change requires restart)
#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
#external_pid_file = '' # write an extra PID file
# (change requires restart)
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
local_bind_address = '10.16.1.89'
port = 26000 # (change requires restart)
max_connections = 3000 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#sysadmin_reserved_connections = 3 # (change requires restart)
unix_socket_directory = '/opt/mogdb/tmp' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
unix_socket_permissions = 0700 # begin with 0 to use octal notation
# (change requires restart)
# - Security and Authentication -
#authentication_timeout = 1min # 1s-600s
session_timeout = 0 # allowed duration of any unused session, 0s-86400s(1 day), 0 is disabled
ssl = on # (change requires restart)
#ssl_ciphers = 'ALL' # allowed SSL ciphers
# (change requires restart)
#ssl_cert_notify_time = 90 # 7-180 days
#ssl_renegotiation_limit = 0 # amount of data between renegotiations, no longer supported
ssl_cert_file = 'server.crt' # (change requires restart)
ssl_key_file = 'server.key' # (change requires restart)
ssl_ca_file = 'cacert.pem' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
# Kerberos and GSSAPI
#krb_server_keyfile = ''
#krb_srvname = 'postgres' # (Kerberos only)
#krb_caseins_users = off
modify_initial_password = true #Whether to change the initial password of the initial user
#password_policy = 1 #Whether password complexity checks
password_reuse_time = 0 #Whether the new password can be reused in password_reuse_time days
#password_reuse_max = 0 #Whether the new password can be reused
password_lock_time = 0 #The account will be unlocked automatically after a specified period of time
#failed_login_attempts = 10 #Enter the wrong password reached failed_login_attempts times, the current account will be locked
password_encryption_type = 1 #Password storage type, 0 is md5 for PG, 1 is sha256 + md5, 2 is sha256 only
#password_min_length = 8 #The minimal password length(6-999)
#password_max_length = 32 #The maximal password length(6-999)
#password_min_uppercase = 0 #The minimal upper character number in password(0-999)
#password_min_lowercase = 0 #The minimal lower character number in password(0-999)
#password_min_digital = 0 #The minimal digital character number in password(0-999)
#password_min_special = 0 #The minimal special character number in password(0-999)
password_effect_time = 0 #The password effect time(0-999)
#password_notify_time = 7d #The password notify time(0-999)
# - TCP Keepalives -
# see "man 7 tcp" for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
comm_tcp_mode = on # TCP commucation mode for stream between Datanodes (change requires restart)
#comm_sctp_port = 1024 # Assigned by installation (change requires restart)
#comm_control_port = 10001 # Assigned by installation (change requires restart)
#comm_max_datanode = 256 # The number of datanode, include which are expanded (change requires restart)
#comm_max_stream = 1024 # The number of stream, 1-2048 (change requires restart)
#comm_max_receiver = 1 # The number of internal receiver (1-50, default 1, should be smaller than comm_max_datanode, change requires restart)
comm_quota_size = 1024kB # The quota size of each stream, 8-2048000 in KByte, 0 for unlimitation, default unit is kB(change requires restart)
#comm_usable_memory = 4000MB # The total usable memory for communication layer of each datanode process, 100-INT_MAX/2 in MByte, default unit is kB(change requires restart)
#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
# - Memory -
#memorypool_enable = false
#memorypool_size = 512MB
#enable_memory_limit = true
max_process_memory = 37GB
#UDFWorkerMemHardLimit = 1GB
shared_buffers = 18GB # min 128kB
# (change requires restart)
bulk_write_ring_size = 2GB # for bulkload, max shared_buffers
standby_shared_buffers_fraction = 1 #control shared buffers use in standby, 0.1-1.0
#temp_buffers = 8MB # min 800kB
max_prepared_transactions = 3000 # zero disables the feature
# (change requires restart)
# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
# per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# actively intend to use prepared transactions.
work_mem = 64MB # min 64kB
maintenance_work_mem = 2GB # min 1MB
#max_stack_depth = 2MB # min 100kB
cstore_buffers = 16MB #min 16MB
# - Disk -
#temp_file_limit = -1 # limits per-session temp file space
# in kB, or -1 for no limit
#sql_use_spacelimit = -1 # limits for single SQL used space on single DN
# in kB, or -1 for no limit
# - Kernel Resource Usage -
max_files_per_process = 100000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
# - Cost-Based Vacuum Delay -
#vacuum_cost_delay = 0ms # 0-100 milliseconds
#vacuum_cost_page_hit = 1 # 0-10000 credits
#vacuum_cost_page_miss = 10 # 0-10000 credits
#vacuum_cost_page_dirty = 20 # 0-10000 credits
vacuum_cost_limit = 1000 # 1-10000 credits
# - Background Writer -
#bgwriter_delay = 10s # 10-10000ms between rounds
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
# - Asynchronous Behavior -
#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#------------------------------------------------------------------------------
# WRITE AHEAD LOG
#------------------------------------------------------------------------------
# - Settings -
wal_level = logical # minimal, archive, hot_standby or logical
# (change requires restart)
#fsync = on # turns forced synchronization on or off
synchronous_commit = on # synchronization level;
# off, local, remote_receive, remote_write, or on
# It's global control for all transactions
# It could not be modified by gs_ctl reload, unless use setsyncmode.
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
# fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync
full_page_writes = off # recover from partial page writes
wal_buffers = 1GB # min 32kB
# (change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds
#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000
# - Checkpoints -
checkpoint_segments = 1024 # in logfile segments, min 1, 16MB each
#checkpoint_timeout = 15min # range 30s-1h
checkpoint_completion_target = 0.8 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 5min # 0 disables
#checkpoint_wait_timeout = 60s # maximum time wait checkpointer to start
enable_incremental_checkpoint = on # enable incremental checkpoint
incremental_checkpoint_timeout = 60s # range 1s-1h
pagewriter_sleep = 200 # dirty page writer sleep time, 0ms - 1h
# - Archiving -
archive_mode = on # allows archiving to be done
# (change requires restart)
#archive_command = '' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
#archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
archive_dest = '/u01/mogarchive' # path to use to archive a logfile segment
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - heartbeat -
#datanode_heartbeat_interval = 1s # The heartbeat interval of the standby nodes.
# The value is best configured less than half of
# the wal_receiver_timeout and wal_sender_timeout.
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
max_wal_senders = 16 # max number of walsender processes
# (change requires restart)
wal_keep_segments = 1024 # in logfile segments, 16MB each; 0 disables
#wal_sender_timeout = 6s # in milliseconds; 0 disables
enable_slot_log = on
max_replication_slots = 32 # max number of replication slots.i
# The value belongs to [1,7].
# (change requires restart)
#max_changes_in_memory = 4096
#max_cached_tuplebufs = 8192
replconninfo1 = 'localhost=10.16.1.89 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=10.16.1.90 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004' # replication connection information used to connect primary on standby, or standby on primary,
# or connect primary or standby on secondary
# The heartbeat thread will not start if not set localheartbeatport and remoteheartbeatport.
# e.g. 'localhost=10.145.130.2 localport=12211 localheartbeatport=12214 remotehost=10.145.130.3 remoteport=12212 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12213 remotehost=10.145.133.3 remoteport=12214'
#replconninfo2 = '' # replication connection information used to connect secondary on primary or standby,
# or connect primary or standby on secondary
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.4 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.4 remoteport=12314'
#replconninfo3 = '' # replication connection information used to connect primary on standby, or standby on primary,
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.5 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.5 remoteport=12314'
#replconninfo4 = '' # replication connection information used to connect primary on standby, or standby on primary,
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.6 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.6 remoteport=12314'
#replconninfo5 = '' # replication connection information used to connect primary on standby, or standby on primary,
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.7 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.7 remoteport=12314'
#replconninfo6 = '' # replication connection information used to connect primary on standby, or standby on primary,
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.8 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.8 remoteport=12314'
#replconninfo7 = '' # replication connection information used to connect primary on standby, or standby on primary,
# e.g. 'localhost=10.145.130.2 localport=12311 localheartbeatport=12214 remotehost=10.145.130.9 remoteport=12312 remoteheartbeatport=12215, localhost=10.145.133.2 localport=12313 remotehost=10.145.133.9 remoteport=12314'
# - Master Server -
# These settings are ignored on a standby server.
synchronous_standby_names = 'ANY 1(dn_6002)' # standby servers that provide sync rep
# comma-separated list of application_name
# from standby(s); '*' = all
most_available_sync = on # Whether master is allowed to continue
# as standbalone after sync standby failure
# It's global control for all transactions
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
data_replicate_buffer_size = 128MB # data replication buffer size
walsender_max_send_size = 8MB # Size of walsender max send size
enable_data_replicate = off
# - Standby Servers -
# These settings are ignored on a master server.
hot_standby = on # "on" allows queries during recovery
# (change requires restart)
#max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive;
# -1 allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries
# when reading streaming WAL;
# -1 allows indefinite delay
#wal_receiver_status_interval = 5s # send replies at least this often
# 0 disables
#hot_standby_feedback = off # send info from standby to prevent
# query conflicts
wal_receiver_timeout = 60s # time that receiver waits for
# communication from master
# in milliseconds; 0 disables
#wal_receiver_connect_timeout = 1s # timeout that receiver connect master
# in seconds; 0 disables
#wal_receiver_connect_retries = 1 # max retries that receiver connect master
#wal_receiver_buffer_size = 64MB # wal receiver buffer size
#enable_xlog_prune = on # xlog keep for all standbys even through they are not connecting and donnot created replslot.
max_size_for_xlog_prune = 104857600 # xlog keep for the wal size less than max_xlog_size when the enable_xlog_prune is on
#------------------------------------------------------------------------------
# QUERY TUNING
#------------------------------------------------------------------------------
# - Planner Method Configuration -
#enable_bitmapscan = on
#enable_hashagg = on
#enable_hashjoin = on
#enable_indexscan = on
#enable_indexonlyscan = on
#enable_material = on
enable_mergejoin = on
enable_nestloop = on
#enable_seqscan = on
#enable_sort = on
#enable_tidscan = on
enable_kill_query = off # optional: [on, off], default: off
# - Planner Cost Constants -
#seq_page_cost = 1.0 # measured on an arbitrary scale
#random_page_cost = 4.0 # same scale as above
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
#effective_cache_size = 128MB
# - Genetic Query Optimizer -
#geqo = on
#geqo_threshold = 12
#geqo_effort = 5 # range 1-10
#geqo_pool_size = 0 # selects default based on effort
#geqo_generations = 0 # selects default based on effort
#geqo_selection_bias = 2.0 # range 1.5-2.0
#geqo_seed = 0.0 # range 0.0-1.0
# - Other Planner Options -
#default_statistics_target = 100 # range 1-10000
#constraint_exclusion = partition # on, off, or partition
#cursor_tuple_fraction = 0.1 # range 0.0-1.0
#from_collapse_limit = 8
#join_collapse_limit = 8 # 1 disables collapsing of explicit
# JOIN clauses
#plan_mode_seed = 0 # range -1-0x7fffffff
#check_implicit_conversions = off
#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
# - Where to Log -
#log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# depending on platform. csvlog
# requires logging_collector to be on.
# This is used when logging to stderr:
logging_collector = on # Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart)
# These are only used if logging_collector is on:
log_directory = '/var/log/mogdb/omm/pg_log/dn_6001' # directory where log files are written,
# can be absolute or relative to PGDATA
log_filename = 'postgresql_%d.log' # log file name pattern,
# can include strftime() escapes
log_file_mode = 0600 # creation mode for log files,
# begin with 0 to use octal notation
log_truncate_on_rotation = on # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on
# time-driven rotation, not on restarts
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
#log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. 0 disables.
log_rotation_size = 20MB # Automatic rotation of logfiles will
# happen after that much log output.
# 0 disables.
# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'
# - When to Log -
#log_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic
#log_min_error_statement = error # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# info
# notice
# warning
# error
# log
# fatal
# panic (effectively off)
log_min_duration_statement = 1800000 # -1 is disabled, 0 logs all statements
# and their durations, > 0 logs only
# statements running at least this number
# of milliseconds
# - What to Log -
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
log_checkpoints = on
#log_pagewriter = off
log_connections = off # log connection requirement from client
log_disconnections = off # log disconnection from client
log_duration = on # log the execution time of each query
# when log_duration is on and log_min_duration_statement
# is larger than zero, log the ones whose execution time
# is larger than this threshold
#log_error_verbosity = default # terse, default, or verbose messages
log_hostname = on # log hostname
log_line_prefix = '%m %u %d %r %p %S' # special values:
# %a = application name
# %u = user name
# %d = database name
# %r = remote host and port
# %h = remote host
# %p = process ID
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %n = DataNode name
# %i = command tag
# %e = SQL state
# %c = logic thread ID
# %l = session line number
# %s = session start timestamp
# %v = virtual transaction ID
# %x = transaction ID (0 if none)
# %q = stop here in non-session
# processes
# %S = session ID
# %% = '%'
# e.g. '<%u%%%d> '
#log_lock_waits = off # log lock waits >= deadlock_timeout
#log_statement = 'none' # 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
log_timezone = 'PRC'
#------------------------------------------------------------------------------
# ALARM
#------------------------------------------------------------------------------
enable_alarm = off
connection_alarm_rate = 0.9
alarm_report_interval = 10
alarm_component = '/opt/huawei/snas/bin/snas_cm_cmd'
#------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------
# - Query/Index Statistics Collector -
#track_activities = on
#track_counts = on
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
#update_process_title = on
#stats_temp_directory = 'pg_stat_tmp'
#track_thread_wait_status_interval = 30min # 0 to disable
track_sql_count = off
#enbale_instr_track_wait = on
# - Statistics Monitoring -
#log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off
#------------------------------------------------------------------------------
# WORKLOAD MANAGER
#------------------------------------------------------------------------------
use_workload_manager = off # Enables workload manager in the system.
# (change requires restart)
#------------------------------------------------------------------------------
# SECURITY POLICY
#------------------------------------------------------------------------------
#enable_security_policy = off
#use_elastic_search = off
#elastic_search_ip_addr = 'https://127.0.0.1' # what elastic search ip is, change https to http when elastic search is non-ssl mode
#enable_backend_control = on
#enable_vacuum_control = on
#max_active_statements = 60
#cpu_collect_timer = 30
#parctl_min_cost = 100000
#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------
autovacuum = on # Enable autovacuum subprocess? default value is 'on'
# requires track_counts to also be on.
#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
# their durations, > 0 logs only
# actions running at least this number
# of milliseconds.
autovacuum_max_workers = 10 # max number of autovacuum subprocesses
# (change requires restart)
autovacuum_naptime = 20s # time between autovacuum runs
autovacuum_vacuum_threshold = 200 # min number of row updates before
# vacuum
autovacuum_analyze_threshold = 200 # min number of row updates before
# analyze
autovacuum_vacuum_scale_factor = 0.05 # fraction of table size before vacuum
autovacuum_analyze_scale_factor = 0.02 # fraction of table size before analyze
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
# (change requires restart)
autovacuum_vacuum_cost_delay = 10 # default vacuum cost delay for
# autovacuum, in milliseconds;
# -1 means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
# autovacuum, -1 means use
# vacuum_cost_limit
#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS
#------------------------------------------------------------------------------
# - Statement Behavior -
#client_min_messages = notice # values in order of decreasing detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# log
# notice
# warning
# error
#search_path = '"$user",public' # schema names
#default_tablespace = '' # a tablespace name, '' uses the default
#temp_tablespaces = '' # a list of tablespace names, '' uses
# only default tablespace
#check_function_bodies = on
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#default_transaction_deferrable = off
#session_replication_role = 'origin'
#statement_timeout = 0 # in milliseconds, 0 is disabled
#vacuum_freeze_min_age = 50000000
#vacuum_freeze_table_age = 150000000
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content'
#max_compile_functions = 1000
#gin_pending_list_limit = 4MB
# - Locale and Formatting -
datestyle = 'iso, mdy'
#intervalstyle = 'postgres'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
# abbreviations. Currently, there are
# Default
# Australia
# India
# You can create your own file in
# share/timezonesets/.
#extra_float_digits = 0 # min -15, max 3
#client_encoding = sql_ascii # actually, defaults to database
# encoding
# These settings are initialized by initdb, but they can be changed.
lc_messages = 'en_US.UTF-8' # locale for system error message
# strings
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
lc_numeric = 'en_US.UTF-8' # locale for number formatting
lc_time = 'en_US.UTF-8' # locale for time formatting
# default configuration for text search
default_text_search_config = 'pg_catalog.english'
# - Other Defaults -
#dynamic_library_path = '$libdir'
#local_preload_libraries = ''
#------------------------------------------------------------------------------
# LOCK MANAGEMENT
#------------------------------------------------------------------------------
#deadlock_timeout = 1s
lockwait_timeout = 1min # Max of lockwait_timeout and deadlock_timeout + 1s
#max_locks_per_transaction = 256 # min 10
# (change requires restart)
# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
# lock table slots.
#max_pred_locks_per_transaction = 64 # min 10
# (change requires restart)
#------------------------------------------------------------------------------
# VERSION/PLATFORM COMPATIBILITY
#------------------------------------------------------------------------------
# - Previous PostgreSQL Versions -
#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#default_with_oids = off
#escape_string_warning = on
#lo_compat_privileges = off
#quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on
#synchronize_seqscans = on
# - Other Platforms and Clients -
#transform_null_equals = off
##------------------------------------------------------------------------------
# ERROR HANDLING
#------------------------------------------------------------------------------
#exit_on_error = off # terminate session on any error?
#restart_after_crash = on # reinitialize after backend crash?
#omit_encoding_error = off # omit untranslatable character error
#data_sync_retry = off # retry or panic on failure to fsync data?
#------------------------------------------------------------------------------
# DATA NODES AND CONNECTION POOLING
#------------------------------------------------------------------------------
#pooler_maximum_idle_time = 60 # Maximum idle time of the pooler links.
# in minutes; 0 disables
#minimum_pool_size = 200 # Initial pool size
# (change requires restart)
#pooler_connect_max_loops = 1 # Max retries of the Pooler Connecting to Other Nodes
# (change requires restart)
#pooler_connect_interval_time = 15 # Indicates the interval for each retry..
# in seconds; 0 disables
#max_pool_size = 400 # Maximum pool size
# (change requires restart)
#persistent_datanode_connections = off # Set persistent connection mode for pooler
# if set at on, connections taken for session
# are not put back to pool
#max_coordinators = 16 # Maximum number of Coordinators
# that can be defined in cluster
# (change requires restart)
#max_datanodes = 16 # Maximum number of Datanodes
# that can be defined in cluster
# (change requires restart)
#cache_connection = on # pooler cache connection
#pooler_timeout = 600 # timeout of the pooler communication with other nodes
# in seconds; 0 disables
#pooler_connect_timeout = 60 # timeout of the pooler connecting to other nodes
# in seconds; 0 disables
#pooler_cancel_timeout = 15 # timeout of the pooler cancel connections to other nodes
# in seconds; 0 disables
#------------------------------------------------------------------------------
# GTM CONNECTION
#------------------------------------------------------------------------------
#gtm_host = 'localhost' # Host name or address of GTM
# (change requires restart)
#gtm_port = 6666 # Port of GTM
# (change requires restart)
#gtm_host1 = 'localhost' # Host1 name or address of GTM
# (change requires restart)
#gtm_port1 = 6665 # Port1 of GTM
# (change requires restart)
#gtm_host2 = 'localhost' # Host2 name or address of GTM
# (change requires restart)
#gtm_port2 = 6664 # Port2 of GTM
# (change requires restart)
#gtm_host3 = 'localhost' # Host3 name or address of GTM
# (change requires restart)
#gtm_port3 = 6663 # Port3 of GTM
# (change requires restart)
#gtm_host4 = 'localhost' # Host4 name or address of GTM
# (change requires restart)
#gtm_port4 = 6662 # Port4 of GTM
# (change requires restart)
#gtm_host5 = 'localhost' # Host5 name or address of GTM
# (change requires restart)
#gtm_port5 = 6661 # Port5 of GTM
# (change requires restart)
#gtm_host6 = 'localhost' # Host6 name or address of GTM
# (change requires restart)
#gtm_port6 = 6660 # Port6 of GTM
# (change requires restart)
#gtm_host7 = 'localhost' # Host7 name or address of GTM
# (change requires restart)
#gtm_port7 = 6659 # Port7 of GTM
# (change requires restart)
pgxc_node_name = 'dn_6001_6002' # Coordinator or Datanode name
# (change requires restart)
#gtm_backup_barrier = off # Specify to backup gtm restart point for each barrier.
#gtm_conn_check_interval = 10 # sets the timeout to check gtm connection
# in seconds, 0 is disabled
##------------------------------------------------------------------------------
# OTHER PG-XC OPTIONS
#------------------------------------------------------------------------------
#enforce_two_phase_commit = on # Enforce the usage of two-phase commit on transactions
# where temporary objects are used or ON COMMIT actions
# are pending.
# Usage of commit instead of two-phase commit may break
# data consistency so use at your own risk.
# - Postgres-XC specific Planner Method Configuration
#enable_fast_query_shipping = on
#enable_remotejoin = on
#enable_remotegroup = on
#enable_remotelimit = on
#enable_remotesort = on
#------------------------------------------------------------------------------
# AUDIT
#------------------------------------------------------------------------------
audit_enabled = off
audit_directory = '/var/log/mogdb/omm/pg_audit/dn_6001'
#audit_data_format = 'binary'
#audit_rotation_interval = 1d
#audit_rotation_size = 10MB
#audit_space_limit = 1024MB
#audit_file_remain_threshold = 1048576
#audit_login_logout = 7
#audit_database_process = 1
#audit_user_locked = 1
#audit_user_violation = 0
#audit_grant_revoke = 1
#audit_system_object = 12295
#audit_dml_state = 0
#audit_dml_state_select = 0
#audit_function_exec = 0
#audit_copy_exec = 0
#audit_set_parameter = 1 # whether audit set parameter operation
#Choose which style to print the explain info, normal,pretty,summary,run
explain_perf_mode = pretty
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
# Add settings for extensions here
# ENABLE DATABASE PRIVILEGES SEPARATE
#------------------------------------------------------------------------------
#enableSeparationOfDuty = off
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# ADIO
#------------------------------------------------------------------------------
#enable_fast_allocate = off
#prefetch_quantity = 32MB
#backwrite_quantity = 8MB
#cstore_prefetch_quantity = 32768 #unit kb
#cstore_backwrite_quantity = 8192 #unit kb
#cstore_backwrite_max_threshold = 2097152 #unit kb
#fast_extend_file_size = 8192 #unit kb
#------------------------------------------------------------------------------
# LLVM
#------------------------------------------------------------------------------
enable_codegen = off # consider use LLVM optimization
#enable_codegen_print = off # dump the IR function
#codegen_cost_threshold = 10000 # the threshold to allow use LLVM Optimization
#------------------------------------------------------------------------------
# JOB SCHEDULER OPTIONS
#------------------------------------------------------------------------------
job_queue_processes = 10 # Number of concurrent jobs, optional: [0..1000], default: 10.
#------------------------------------------------------------------------------
# NODEGROUP OPTIONS
#------------------------------------------------------------------------------
default_storage_nodegroup = 'installation' # Default storage group, when TO GROUP is not specified in create-table clause,
# the created table is distributed into default storage node group,
# “installation” is preserved key words to indicate create table into "installation group" when there is no TO-GROUP in DDL.
expected_computing_nodegroup = 'query' # Use node group as target computing nodegroup,
# where any JOIN/AGG operation goes there to do actual computation works.
#------------------------------------------------------------------------------
# STREAMING
#------------------------------------------------------------------------------
#enable_streaming = off # Consider use streaming engine, default is off
#streaming_router_port = 5438 # Port the streaming router listens on, please keep the value (streaming_router_port - port) not change.
# default port is (port + 6), setting by kernel, range 0 ~ 65535,
# value 0 means use default value (port + 6).
#streaming_gather_window_interval = 5 # interval of streaming gather window,
# default value is 5, range 5 ~ 1440
#streaming_num_workers = 1 # Number of streaming engine worker threads,
# default value is 1, range 1 ~ 64
#streaming_num_collectors = 1 # Number of streaming engine collector threads,
# default value is 1, range 1 ~ 64
#streaming_num_queues = 1 # Number of streaming engine queue threads,
# default value is 1, range 1 ~ 64
#streaming_batch_size = 10000 # Max packed tuples of streaming microbatch,
# default value is 10000, range 1 ~ 100000000
#streaming_batch_memory = 65536 # Max process memory (KB) of streaming microbatch,
# default value is 65536, range 4096 ~ 1048576
#streaming_batch_timeout = 500 # Receive timeout (ms) of streaming microbatch,
# default value is 500, range 1 ~ 60000
#streaming_collect_memory = 65536 # Max collect memory (KB) of streaming collector thread,
# default value is 65536, range 4096 ~ 33554432
#streaming_flush_interval = 500 # Flush interval (ms) of streaming collector thread,
# default value is 500, range 1 ~ 1200000
replication_type = 1
application_name = 'dn_6001'
recovery_max_workers = 4
enable_double_write = on
available_zone = 'AZ1'
local_syscache_threshold = 32MB
remote_read_mode = non_authentication
wal_log_hints = off
xloginsert_locks = 48
advance_xlog_file_num = 10
catchup2normal_wait_time = 0
sync_config_strategy = none_node
plog_merge_age = 0
autovacuum_io_limits = 104857600
instr_unique_sql_count = 5000
enable_save_datachanged_timestamp = off
enable_instr_rt_percentile = off
enable_instance_metric_persistent = off
enable_logical_io_statistics = off
enable_user_metric_persistent = off
enable_pbe_optimization = off
enable_resource_track = on
enable_wdr_snapshot = on
enable_asp = off
update_lockwait_timeout = 1min
behavior_compat_options = 'display_leading_zero'
enable_thread_pool = off
发现版本:
MogDB v2.0.1
(MogDB v2.1.0及之后的版本中已确认没有该问题)
故障现场描述:
所有安装MogDB v2.0.1的客户都出现了不同程度的内存泄漏。使用trace memory usage的工具观测到,内存泄漏出现在Wal Sender使用的memory context。泄漏最严重的客户的Wal Sender的总泄漏量达到35GB。(故障发生时的MogDB设置为一台主机一台备机,配置见附件)
如下,上图为初始的Wal Sender memory context的size, 8200KB。在没有任何额外数据库访问的情况下,5分钟后,Wal Sender memory context的size增加到了8696KB。


故障原因:
内存泄漏发生在XLOG日志发送端walsender线程中。在打开备机归档(archive_mode = on)功能的情况下,walsender线程需要发送archive lsn消息。此逻辑执行时,用于获取备库列表的链表数据结构用完后没有被释放,因此产生了内存泄漏。这导致walsender产生了缓慢的内存占用持续增长的现象。
不同客户的泄漏量不同与walsender向备库发送wal数据的次数有关。
例如:一共发了1G的日志,然后A一次发8KB, B一次发1KB。导致的内存泄漏数量是不一样的。当数据量少时,walsender一直在wait,产生的泄露也少。
解决方案:
-
临时解决方案
可以通过重启备库,临时规避
-
长期解决方案
修复内存泄漏问题,发布补丁
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




