HGDB5.6.5集群备机手动switchover提示data目录无效
Posted 瀚高PG实验室
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HGDB5.6.5集群备机手动switchover提示data目录无效相关的知识,希望对你有一定的参考价值。
目录
环境
症状
问题原因
解决方案
相关文档
报错编码
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:5.6.5
症状
企业版5.6.5集群在备机中手动执行switchover提示
ERROR: “data_directory” parameter in repmgr.conf on “192.168.197.128” is incorrectly configured
HINT: execute “repmgr node check --data-directory-config” on “192.168.197.128” to diagnose the issue
在主库服务器上执行repmgr node check --data-directory-config,执行成功并返回正确的data目录,
检查hg_repmgr.conf文件中data_directory配置正确。
问题原因
环境变量配置在了bash_profile文件中,由于bash_profile是在用户登录后才会运行,repmgr访问其他服务器时不会去登录用户,即不刷新bash_profile,故找不到data目录。
解决方案
1.在highgo用户下配置bashrc文件,添加以下内容:
export PATH=/opt/HighGo5.6.5-cluster/bin:
P
A
T
H
e
x
p
o
r
t
H
G
B
A
S
E
=
/
o
p
t
/
H
i
g
h
G
o
5.6.5
−
c
l
u
s
t
e
r
e
x
p
o
r
t
P
G
H
O
M
E
=
/
o
p
t
/
H
i
g
h
G
o
5.6.5
−
c
l
u
s
t
e
r
e
x
p
o
r
t
H
G
D
B
H
O
M
E
=
/
o
p
t
/
H
i
g
h
G
o
5.6.5
−
c
l
u
s
t
e
r
e
x
p
o
r
t
P
G
D
A
T
A
=
/
o
p
t
/
H
i
g
h
G
o
5.6.5
−
c
l
u
s
t
e
r
/
d
a
t
a
e
x
p
o
r
t
L
D
L
I
B
R
A
R
Y
P
A
T
H
=
/
o
p
t
/
H
i
g
h
G
o
5.6.5
−
c
l
u
s
t
e
r
/
l
i
b
:
PATH export HG_BASE=/opt/HighGo5.6.5-cluster export PGHOME=/opt/HighGo5.6.5-cluster export HGDB_HOME=/opt/HighGo5.6.5-cluster export PGDATA=/opt/HighGo5.6.5-cluster/data export LD_LIBRARY_PATH=/opt/HighGo5.6.5-cluster/lib:
PATHexportHGBASE=/opt/HighGo5.6.5−clusterexportPGHOME=/opt/HighGo5.6.5−clusterexportHGDBHOME=/opt/HighGo5.6.5−clusterexportPGDATA=/opt/HighGo5.6.5−cluster/dataexportLDLIBRARYPATH=/opt/HighGo5.6.5−cluster/lib:LD_LIBRARY_PATH
2. source bashrc文件,使其生效
source ~/.bashrc
3.备库服务器上执行swichover
[highgo@hgdb-fsg data]$ repmgr standby switchover
NOTICE: executing switchover on node “192.168.197.132” (ID: 1)
NOTICE: local node “192.168.197.132” (ID: 1) will be promoted to primary; current primary “192.168.197.128” (ID: 2) will be demoted to standby
NOTICE: stopping current primary node “192.168.197.128” (ID: 2)
NOTICE: issuing CHECKPOINT
DETAIL: executing server command “/opt/HighGo5.6.5-cluster/bin/pg_ctl -D ‘/opt/HighGo5.6.5-cluster/data’ -W -m fast stop”
INFO: checking for primary shutdown; 1 of 60 attempts (“shutdown_check_timeout”)
INFO: checking for primary shutdown; 2 of 60 attempts (“shutdown_check_timeout”)
NOTICE: current primary has been cleanly shut down at location 0/6000028
NOTICE: promoting standby to primary
DETAIL: promoting server “192.168.197.132” (ID: 1) using “/opt/HighGo5.6.5-cluster/bin/pg_ctl -w -D ‘/opt/HighGo5.6.5-cluster/data’ promote”
waiting for server to promote… 完成
server promoted
NOTICE: waiting up to 60 seconds (parameter “promote_check_timeout”) for promotion to complete
NOTICE: STANDBY PROMOTE successful
DETAIL: server “192.168.197.132” (ID: 1) was successfully promoted to primary
INFO: local node 2 can attach to rejoin target node 1
DETAIL: local node’s recovery point: 0/6000028; rejoin target node’s fork point: 0/6000098
NOTICE: setting node 2’s upstream to node 1
WARNING: unable to ping “host=192.168.197.128 user=hgrepmgr dbname=hgrepmgr password=highgo connect_timeout=2”
DETAIL: PQping() returned “PQPING_NO_RESPONSE”
NOTICE: starting server using “/opt/HighGo5.6.5-cluster/bin/pg_ctl -w -D ‘/opt/HighGo5.6.5-cluster/data’ start”
NOTICE: NODE REJOIN successful
DETAIL: node 2 is now attached to node 1
NOTICE: switchover was successful
DETAIL: node “192.168.197.132” is now primary and node “192.168.197.128” is attached as standby
NOTICE: STANDBY SWITCHOVER has completed successfully
切换成功
4.查看集群状态:
[highgo@hgdb-fsg data]$ repmgr cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Replication lag | Last replayed LSN
----±----------------±--------±----------±----------------±---------±---------±----------------±------------------
1 | 192.168.197.132 | primary | * running | | default | 100 | n/a | none
2 | 192.168.197.128 | standby | running | 192.168.197.132 | default | 100 | 0 bytes | 0/6047328
问题解决
以上是关于HGDB5.6.5集群备机手动switchover提示data目录无效的主要内容,如果未能解决你的问题,请参考以下文章
KingbaseES V8R6集群管理运维案例之---repmgr standby switchover故障