pgpool 负载平衡仅将所有查询发送到 master

ram*_*adh 2 postgresql pgpool load-balancing

我的两个 postgresql 服务器配置为流复制,工作正常。

Pgpool 配置为主从模式/负载平衡模式。

pgpool.conf:

listen_addresses = '*'
port = 9999
backend_hostname0 = 'master-postgres-ip'
backend_port0 = port-no
backend_weight0 = 1
backend_data_directory0 = 'data-dir'
backend_hostname1 = 'slave-postgres-ip'
backend_port1 = port-no
backend_weight1 = 1
backend_data_directory1 = 'data-dir'
load_balance_mode = on
master_slave_mode = on
master_slave_sub_mode='stream'
Run Code Online (Sandbox Code Playgroud)

我预计所有写入查询都将转到主查询,而读取查询将分布在两个查询之间。但是,所有的查询都只是为了掌握。但是,如果我停止主控,查询将变为从属。

有人可以告诉我可能出了什么问题吗?

pgpool 在启动时给出以下日志:

2015-11-03 17:25:56: pid 21284: LOG:  find_primary_node: checking backend no 0
2015-11-03 17:25:56: pid 21284: LOG:  find_primary_node: checking backend no 1
2015-11-03 17:25:56: pid 21284: DEBUG:  SSL is requested but SSL support is not available
2015-11-03 17:25:56: pid 21284: DEBUG:  authenticate kind = 3
2015-11-03 17:25:56: pid 21284: ERROR:  failed to authenticate
2015-11-03 17:25:56: pid 21284: DETAIL:  invalid authentication message response type, Expecting 'R' and received 'E'
2015-11-03 17:25:56: pid 21284: DEBUG:  find_primary_node: no primary node found
Run Code Online (Sandbox Code Playgroud)

ram*_*adh 5

最初,我将其设置sr_check_periodpgpool.conf0(零)以禁用 SR 检查。我想避免这种检查并始终平衡负载。但这却造成了问题。

在我为此属性指定非零值后,负载平衡开始工作。