pgpool 之十一 参数文件 pgpool.conf

$ cat /etc/hosts

192.168.56.99   nodevip
192.168.56.92   node1
192.168.56.90   node2
192.168.56.88   node3

$ /usr/pgpool-3.7/bin/pgpool -n -D > /var/log/pgpool/pgpool.log 2>&1 &
$ /usr/pgpool-3.7/bin/pgpool -m fast stop

$ cat /usr/pgpool-3.7.7/etc/pgpool.conf

#------------------------------------------------------------------------------
# 监听配置
#------------------------------------------------------------------------------
listen_addresses = '*'
port = 9999
socket_dir = '/tmp'
pcp_listen_addresses = '*'
pcp_port = 9898
pcp_socket_dir = '/tmp'
#------------------------------------------------------------------------------
# 后端数据库
#------------------------------------------------------------------------------
backend_hostname0 = '192.168.56.92'
backend_port0 = 5432
backend_weight0 = 1
backend_data_directory0 = '/data/pg9.6/main'
backend_flag0 = 'ALLOW_TO_FAILOVER'
#------------------------------------------------------------------------------
# 后端数据库
#------------------------------------------------------------------------------
backend_hostname1 = '192.168.56.90'
backend_port1 = 5432
backend_weight1 = 1
backend_data_directory1 = '/data/pg9.6/main'
backend_flag1 = 'ALLOW_TO_FAILOVER'
#------------------------------------------------------------------------------
# 后端数据库
#------------------------------------------------------------------------------
backend_hostname2 = '192.168.56.88'
backend_port2 = 5432
backend_weight2 = 1
backend_data_directory2 = '/data/pg9.6/main'
backend_flag2 = 'ALLOW_TO_FAILOVER'
#------------------------------------------------------------------------------
# 认证方式
#------------------------------------------------------------------------------
enable_pool_hba = on
pool_passwd = 'pool_passwd'
authentication_timeout = 60
ssl = off
#------------------------------------------------------------------------------
# 连接池配置
#------------------------------------------------------------------------------
connection_cache = on
reset_query_list = 'ABORT; DISCARD ALL'
num_init_children = 500
max_pool = 4
child_life_time = 300
child_max_connections = 0
connection_life_time = 0
client_idle_limit = 0
#------------------------------------------------------------------------------
# 日志配置
#------------------------------------------------------------------------------
log_destination = 'stderr'
log_line_prefix = '%t: pid %p: '   # printf-style string to output at beginning of each log line.
log_connections = on
log_hostname = on
log_statement = off
log_per_node_statement = off
log_standby_delay = 'if_over_threshold'
syslog_facility = 'LOCAL0'
syslog_ident = 'pgpool'
log_error_verbosity = verbose
#------------------------------------------------------------------------------
# pid信息
#------------------------------------------------------------------------------
pid_file_name = '/tmp/pgpool.pid'
logdir = '/var/log/pgpool'

#------------------------------------------------------------------------------
# pgpool 工作模式
#------------------------------------------------------------------------------
replication_mode = off
load_balance_mode = on
white_function_list = ''
black_function_list = 'currval,lastval,nextval,setval'
master_slave_mode = on
master_slave_sub_mode = 'stream'
#------------------------------------------------------------------------------
# stream 检测
#------------------------------------------------------------------------------
sr_check_period = 5
sr_check_user = 'repl'
sr_check_password = 'replrepl'
sr_check_database = 'postgres'
delay_threshold = 10000000
follow_master_command = '/data/pg9.6/main/pgpool_follow_master %d %h %p %D %m %H %M %P %r %R '
#------------------------------------------------------------------------------
# health check 健康检测
#------------------------------------------------------------------------------
health_check_period = 5
health_check_timeout = 20
health_check_user = 'postgres'
health_check_password = 'postgrespostgres'
health_check_database = 'postgres'
#------------------------------------------------------------------------------
# failover and failback
#------------------------------------------------------------------------------
failover_command = '/data/pg9.6/main/pgpool_failover_stream %d %h %p %D %m %H %M %P %r %R '
failback_command = '/data/pg9.6/main/pgpool_failback_stream %d %h %p %D %m %H %M %P %r %R '
search_primary_node_timeout = 60
#------------------------------------------------------------------------------
# online recovery
#------------------------------------------------------------------------------
recovery_user = 'postgres'
recovery_password = 'postgrespostgres'
recovery_1st_stage_command = '/data/pg9.6/main/pgpool_recovery_1st'
recovery_2nd_stage_command = '/data/pg9.6/main/pgpool_recovery_2nd'
recovery_timeout = 7200
client_idle_limit_in_recovery = -1
#------------------------------------------------------------------------------
# WATCHDOG
#------------------------------------------------------------------------------
use_watchdog = on
ping_path = '/bin'
wd_hostname = '192.168.56.92'
wd_port = 9000
#------------------------------------------------------------------------------
# WATCHDOG vip
#------------------------------------------------------------------------------
delegate_IP = '192.168.56.99'
if_cmd_path = '/sbin'
#if_up_cmd = 'ifconfig eno1:1 inet $_IP_$ netmask 255.255.255.0'
#if_down_cmd = 'ifconfig eno1:1 down'
if_up_cmd = 'ip addr add $_IP_$/24 dev eno1 label eno1:1'
if_down_cmd = 'ip addr del $_IP_$/24 dev eno1 label eno1:1'
arping_path = '/usr/sbin'
arping_cmd = 'arping -q -A -c 1 -I eno1:1 $_IP_$ '
#------------------------------------------------------------------------------
# WATCHDOG heartbeat mode
#------------------------------------------------------------------------------
wd_heartbeat_port = 9694
wd_heartbeat_keepalive = 2
wd_heartbeat_deadtime = 30
heartbeat_destination0 = '192.168.56.90'
heartbeat_destination_port0 = 9694
heartbeat_device0 = 'eno1'
heartbeat_destination1 = '192.168.56.88'
heartbeat_destination_port1 = 9694
heartbeat_device1 = 'eno1'
wd_life_point = 5
wd_lifecheck_method = 'heartbeat'
wd_lifecheck_query = 'select 1'
wd_lifecheck_dbname = 'postgres'
wd_lifecheck_user = 'repl'
wd_lifecheck_password = 'replrepl'
#------------------------------------------------------------------------------
# Other pgpool Connection Settings
#------------------------------------------------------------------------------
other_pgpool_hostname0 = '192.168.56.90'
other_pgpool_port0 = 9999
other_wd_port0 = 9000
other_pgpool_hostname1 = '192.168.56.88'
other_pgpool_port1 = 9999
other_wd_port1 = 9000

你可能感兴趣的:(#,postgresql,ha,pgpool)