How to deal with the situation when there are two standby in pgpool configuration
Pg10@pghost4- > psql-h 10.10.10.15-p 9999 postgres pg10
Password for user pg10:
Psql (10.0)
Type "help" for help.
Postgres=# show pool_nodes
Node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
-+-
0 | pghost4 | 1921 | down |-nan | standby | 0 | false | 0
1 | pghost5 | 1921 | up |-nan | standby | 0 | true | 0
(2 rows)
Postgres=# exit
Postgres-#\ Q
Pg10@pghost4- > pg_controldata | grep cluster
Database cluster state: in production
Pg10@pghost4- > cd / data/pg10@pghost4- > llbr/ > pg10@pghost4- > ll
Drwx-. 2 root root 16K Dec 6 23:28 lost+found
Drwxr-xr-x 3 pg10 pg10 4.0K Dec 18 23:56 pg10
Drwxr-xr-x 3 pg932 pg932 4.0K Dec 6 19:57 pg932
Pg10@pghost4- > cd pg10/pg10@pghost4- > llbr/ > pg10@pghost4- > ll
Drwx- 19 pg10 pg10 4.0K Dec 20 22:58 data
-rw-rw-r-- 1 pg10 pg10 2.8m Dec 18 23:56 data.tar.gz
Pg10@pghost4- > cd datapg10@pghost4- > llbr/ > pg10@pghost4- > ll
Drwx- 5 pg10 pg10 4.0K Dec 18 22:27 base
Drwx- 2 pg10 pg10 4.0K Dec 20 22:59 global
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_commit_ts
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_dynshmem
-rw- 1 pg10 pg10 4.7K Dec 20 22:56 pg_hba.conf
-rw- 1 pg10 pg10 1.6K Dec 18 22:27 pg_ident.conf
Drwx- 4 pg10 pg10 4.0K Dec 20 23:03 pg_logical
Drwx- 4 pg10 pg10 4.0K Dec 18 22:27 pg_multixact
Drwx- 2 pg10 pg10 4.0K Dec 20 22:58 pg_notify
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_replslot
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_serial
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_snapshots
Drwx- 2 pg10 pg10 4.0K Dec 20 22:58 pg_stat
Drwx- 2 pg10 pg10 4.0K Dec 21 00:10 pg_stat_tmp
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_subtrans
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_tblspc
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_twophase
-rw- 1 pg10 pg10 3 Dec 18 22:27 PG_VERSION
Drwx- 3 pg10 pg10 4.0K Dec 20 22:57 pg_wal
Drwx- 2 pg10 pg10 4.0K Dec 18 22:27 pg_xact
-rw- 1 pg10 pg10 88 Dec 18 22:27 postgresql.auto.conf
-rw- 1 pg10 pg10 23K Dec 18 23:50 postgresql.conf
-rw- 1 pg10 pg10 31 Dec 20 22:58 postmaster.opts
-rw- 1 pg10 pg10 74 Dec 20 22:58 postmaster.pid
-rw-r--r-- 1 pg10 pg10 5.8K Dec 20 21:34 recovery.donepg10@pghost4- > exitbr/ > pg10@pghost4- > exit
[root@pghost4 etc] # pgpool stop
.done.
[root@pghost4 etc] # pgpool-C-D
[root@pghost4 etc] # su-pg10
Pg10@pghost4- > psql-h 10.10.10.15-p 9999 postgres pg10
Password for user pg10:
Psql (10.0)
Type "help" for help.
Postgres=# show pool_nodes
Node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
-+-
0 | pghost4 | 1921 | up |-nan | primary | 0 | true | 0
1 | pghost5 | 1921 | up |-nan | standby | 0 | false | 0
(2 rows)
Postgres=#
Pgpool stop # close first
Pgpool-C-D #-C clears the cache-Ddisk-status discards the pgpool_status file without restoring the previous state
And then reconnect.
Psql-p 9999
Reference documentation
Https://blog.csdn.net/lk_db/article/details/77943776
Https://blog.csdn.net/qq_34714193/article/details/88764548