温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

pgpool 配置的时候出现两个standby的情况处理办法

发布时间:2020-03-01 23:37:13 来源:网络 阅读:630 作者:李石岩 栏目:数据库

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->ll
br/>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->ll
br/>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->ll
br/>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->exit
br/>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 #先关闭

pgpool -C -D #-C清除缓存 -Ddisk-status丢弃pgpool_status文件,不恢复以前的状态

然后重新连接

psql -p 9999

参考文档
https://blog.csdn.net/lk_db/article/details/77943776
https://blog.csdn.net/qq_34714193/article/details/88764548

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI