首页 > 解决方案 > PGPOOL 从节点处于“等待”状态

问题描述

我正在尝试使用主从配置一个简单的 pgpool(都在同一台机器上 - 不同的端口)。每当我通过进入 pgpoolpsql -p 9999并运行时,show pool_nodes;我都会看到主从集群,但从属状态是waiting(它们都在运行)。主从配置primaryhot_standby复制。但是每当我通过 pgpool 插入/选择时,所有这些都通过主...

su - postgres
mkdir production_server
mkdir slave1
mkdir slave_archive
create new cluster on production_server

changes for those values on postgresql.conf (production_server):
-------------------------------------------------------
wal_level = replica
archive_mode on
listen_address = *
archive_command= cp %p /var/lib/pgsql/slave_archive/%f
port=5435
-------------------------------------------------------

restart the cluster on production_server
pg_basebackup -p 5435 -D /var/lib/pgsql/slave1

changes for those values on postgresql.conf (slave1):
-------------------------------------------------------
port=5466
hot_standby=on
primary_conninfo= host =127.0.0.1 port=5435
restore_command = cp /var/lib/pgsql/slave_archive/%f %p
-------------------------------------------------------

create also a standby.signal file (we're using postgres version 12.x)
switch to root and chmod 700 on slave1 directory
switch back to postgres: su - postgres
start the cluster on -D /var/lib/pgsql/slave1


psql -p 5435
create table table1 as SELECT * FROM generate_series(1, 10000);
select pg_switch_wal();
---> on psql -p 5466 we will also see this insert/table


let's configure the pg_pool:
------------------------------------------------------------
cd /etc/pgpool-II
cp pgpool.conf.sample pgpool.conf
vi pgpool.conf:
----------------------------------------
listen_address=*
backend_hostname0=127.0.0.1
backend_port0=5435
backend_directory0=/var/lib/pgsql/production_server 


backend_hostname0=127.0.0.1
backend_port0=5466
backend_directory0=/var/lib/pgsql/slave1 
health_check_user=postgres

----------------------------------------

./pgpool &
psql -p 9999 
in order to see the active nodes in the pool run:
show pool_nodes;
---> we need to recieve 2 nodes: 5435 / 5466

这是我配置 pgpool + master & slave 的脚本。如何解决等待状态?

标签: postgresqlconnection-poolingpgpool

解决方案


我在安装 pgpool-II-12* 包(4.1 版本)时遇到了同样的问题。找不到任何解决方案,因此我将其删除并从此处安装了 pgpool-II-pg12* 软件包(4.2 版本)并对其进行了配置。它适用于这个版本。


推荐阅读