fix postgresql

This commit is contained in:
jxxghp
2025-08-18 19:12:20 +08:00
parent f6a6efdc42
commit 83958a4a48
4 changed files with 108 additions and 9 deletions

View File

@@ -0,0 +1,29 @@
# PostgreSQL Client Authentication Configuration File
# ===========================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
# 允许所有IPv4连接用于Docker容器内部通信
host all all 0.0.0.0/0 md5
# 允许所有IPv6连接
host all all ::/0 md5

View File

@@ -0,0 +1,65 @@
# PostgreSQL configuration file template
# This file will be processed by envsubst to replace environment variables
# Connection and Authentication
listen_addresses = '*'
port = ${DB_POSTGRESQL_PORT:-5432}
max_connections = 100
# Memory Configuration
shared_buffers = 128MB
effective_cache_size = 256MB
work_mem = 4MB
maintenance_work_mem = 64MB
# Logging Configuration
log_destination = 'stderr'
logging_collector = on
log_directory = '${POSTGRESQL_LOG_DIR}'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 1d
log_rotation_size = 100MB
log_min_messages = warning
log_min_error_statement = error
log_min_duration_statement = 1000
# Query Tuning
random_page_cost = 1.1
effective_io_concurrency = 200
# WAL Configuration
wal_level = replica
max_wal_size = 1GB
min_wal_size = 80MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
# Background Writer
bgwriter_delay = 200ms
bgwriter_lru_maxpages = 100
bgwriter_lru_multiplier = 2.0
# Autovacuum
autovacuum = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min
autovacuum_vacuum_threshold = 50
autovacuum_analyze_threshold = 50
# Client Connection Defaults
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
default_text_search_config = 'pg_catalog.english'
# Locale and Formatting
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
default_text_search_config = 'pg_catalog.english'