PGPOOL slave node on 'waiting' status

1.4k Views Asked by At

I am trying to configure a simple pgpool with master and slave (all on the same machine - different ports). whenever I enter the pgpool via psql -p 9999 and run show pool_nodes; I see the master and slave clusters but the slave status is waiting (both of them running). The master and slave are configured as primary and hot_standby for replication. but whenever I insert/select through the pgpool all goes through the master... I want to get to a point that inserts will be made in the primary and the selects will go in slave.

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

This is my script to configure the pgpool + master & slave. How do I solve the waiting status?

1

There are 1 best solutions below

0
On

I faced the same problem when i installed pgpool-II-12* package (4.1 version). Couldn't find any solution for that so I removed it and installed pgpool-II-pg12* package (4.2 version) from here and configured it. It worked fine for this version.