pgpool.conf 配置文件:
load_balance_mode = on
listen_addresses = '*'
port = 9999
backend_hostname0 = '192.168.1.74'
backend_port0 = 5432
backend_weight0 = 1
backend_data_directory0 = '/www/postgresql/pg_data'
backend_flag0 = 'ALLOW_TO_FAILOVER'
backend_hostname1 = '192.168.1.70'
backend_port1 = 5432
backend_weight1 = 1
backend_data_directory1 = '/www/postgresql/pg_data'
backend_flag1 = 'ALLOW_TO_FAILOVER'
日志:
Oct 6 15:40:55 localhost pgpool[8796]: [312-43] #011 #011LIMIT $3 OFFSET $4"
Oct 6 15:40:55 localhost pgpool[8796]: [313-1] 2019-10-06 15:40:55: pid 8796: LOG: DB node id: 0 backend pid: 8812 statement: Parse: SELECT
Oct 6 15:40:55 localhost pgpool[8796]: [313-2] #011 #011dsca.id, dsca.deletetime, dsca.deleter,
Oct 6 15:40:55 localhost pgpool[8796]: [313-13] #011#011 dsca.is_have_order_reverse isH
Oct 6 15:40:55 localhost pgpool[8796]: [314-1] 2019-10-06 15:40:55: pid 8796: LOG: Bind message from frontend.
Oct 6 15:40:55 localhost pgpool[8796]: [314-2] 2019-10-06 15:40:55: pid 8796: DETAIL: portal: "", statement: ""
Oct 6 15:40:55 localhost pgpool[8796]: [315-1] 2019-10-06 15:40:55: pid 8796: LOG: DB node id: 0 backend pid: 8812 statement: B message
Oct 6 15:40:55 localhost pgpool[8796]: [316-1] 2019-10-06 15:40:55: pid 8796: LOG: Describe message from frontend.
Oct 6 15:40:55 localhost pgpool[8796]: [316-2] 2019-10-06 15:40:55: pid 8796: DETAIL: portal: ""
Oct 6 15:40:55 localhost pgpool[8796]: [317-1] 2019-10-06 15:40:55: pid 8796: LOG: DB node id: 0 backend pid: 8812 statement: D message
Oct 6 15:40:55 localhost pgpool[8796]: [318-1] 2019-10-06 15:40:55: pid 8796: LOG: Execute message from frontend.
Oct 6 15:40:55 localhost pgpool[8796]: [318-2] 2019-10-06 15:40:55: pid 8796: DETAIL: portal: ""
Oct 6 15:40:55 localhost pgpool[8796]: [319-1] 2019-10-06 15:40:55: pid 8796: LOG: DB node id: 0 backend pid: 8812 statement: Execute: SELECT
如上配置,java程序和navicat通过9999端口去连接,一直都是使用backend_hostname0读取数据,寻找懂pgpool分发的大神,帮忙解决问题。谢谢