Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pgAdmin connection error to pgpool

I'm using pgAdmin III to manage my database from client. I have a master and a slave postgreSQL running in streaming replication mode. There's another pgpool server in front of them to do connection pooling and load-balancing.

When I was connection pgAdmin to pgpool, I got:

Error connecting to the server: ERROR: unable to read message kind
DETAIL: kind does not match between master(52) slot[1] (45)

I had no problem connecting to it before, but somehow pgpool died and I restarted it, and then this error popped up out of no where.

The pgpool and postgreSQL servers are running well. I can access them with psql -h hostname database user. The app server can also connect to it and the web app is running as usually. I just cannot access it from pgAdmin.

like image 358
J Freebird Avatar asked Feb 17 '16 18:02

J Freebird


1 Answers

http://www.sraoss.jp/pipermail/pgpool-general/2012-March/000297.html

In short: max_connections is exceeded on postgres cluster.

What I assume has happened - you restarted pgpool and it opened new connections to postgres, while old ones left in idle or idle in transaction (depending on timeout). So after restarting pgpool it consumed double amount of num_init_children and reached actual allowed maximum.

Killing old (before restart) pgpool connections should fix it. Try pg_terminate_backend(pid) run on postgres in order to do it. Also be carefull to kill right connections. At least check

select pid,query, client_address 
from pg_stat_activity where now()-query_start > '1 day'::interval

or alike to catch only zombies

like image 150
Vao Tsun Avatar answered Sep 22 '22 15:09

Vao Tsun