Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

postgresql - 在PostgreSQL 9.4.1中的切换和回切中是否为强制性参数recovery_target_timeline ='latest'?(Is it mandatory parameter recover_target_timeline='latest' in switchover and switchback in PostgreSQL 9.4.1?)

I have followed below steps for switchover and switchback.

(我已按照以下步骤进行切换和切回。)

Step 1:- Disconnect application services from 10.xx10 and do the following

(步骤1:-从10.xx10断开应用程序服务并执行以下操作)

@Master(10.xx10)

(@Master(10.xx10))

pg_ctl -D /DATA_VEC/pgdata stop --mode=fast

@DR(20.xx20)

(@DR(20.xx20))

promote DR as read write mode

(将DR提升为读写模式)

Step 2:- Start master as DR from new primary

(步骤2:-从新的主服务器启动主服务器作为DR)

@Master(10.xx10) create recovery.conf

(@Master(10.xx10)创建recovery.conf)

standby_mode = 'on'
primary_conninfo = 'user= password= host=20.x.x.20 port=9999
trigger_file = '/tmp/node1'
restore_command = 'cp /DATA_VEC/restore/%f "%p"'
pg_ctl -D /DATA_VEC/pgdata start

after promotion new standby, old primary not getting syncing with new primary server(old standby) Logs from DR server which was primary.

(升级新的备用数据库后,旧的主要数据库无法与新的主服务器(旧的备用数据库)同步。)

2019-12-01 18:46:56 IST LOG:  database system was shut down in recovery at 2019-12-01 18:46:53 IST
2019-12-01 18:46:56 IST LOG:  entering standby mode
cp: cannot stat `/DATA_VEC/restore/00000002.history': No such file or directory
2019-12-01 18:46:56 IST LOG:
2019-12-01 18:46:56 IST LOG:  restored log file "00000002000000000000000C" from archive
2019-12-01 18:46:57 IST LOG:  consistent recovery state reached at 0/C000090
2019-12-01 18:46:57 IST LOG:  record with zero length at 0/C000090
2019-12-01 18:46:57 IST LOG:  database system is ready to accept read only connections
2019-12-01 18:46:57 IST LOG:  started streaming WAL from primary at 0/C000000 on timeline 2
2019-12-01 18:46:57 IST LOG:  replication terminated by primary server
2019-12-01 18:46:57 IST DETAIL:  End of WAL reached on timeline 2 at 0/C000090.
2019-12-01 18:46:57 IST LOG:  restored log file "00000002000000000000000C" from archive
2019-12-01 18:46:57 IST LOG:  record with zero length at 0/C000090
2019-12-01 18:46:57 IST LOG:  restarted WAL streaming at 0/C000000 on timeline 2
2019-12-01 18:46:57 IST LOG:  replication terminated by primary server
2019-12-01 18:46:57 IST DETAIL:  End of WAL reached on timeline 2 at 0/C000090.

@Master(10.xx10)

(@Master(10.xx10))

Pg_xlog content

(pg_xlog内容)

-bash-4.1$ cd pg_xlog
-bash-4.1$ ll
total 65552
-rw------- 1 postgres postgres      302 Dec  1 12:52 00000002000000000000000A.00000028.backup
-rw------- 1 postgres postgres 16777216 Dec  1 13:52 00000002000000000000000B
-rw------- 1 postgres postgres 16777216 Dec  1 14:28 00000002000000000000000C
-rw------- 1 postgres postgres 16777216 Dec  1 12:52 00000002000000000000000D
-rw------- 1 postgres postgres 16777216 Dec  1 12:52 00000002000000000000000E
-rw------- 1 postgres postgres       41 Dec  1 13:57 00000002.history
-rw------- 1 postgres postgres       83 Dec  1 13:57 00000003.history
drwx------ 2 postgres postgres     4096 Dec  1 13:57 archive_status

@in restore_command location content:-

(@在restore_command位置内容中:-)

-bash-4.1$ cd /DATA_VEC/restore/ -bash-4.1$ ll total 49156 -rw------- 1 postgres postgres 16777216 Dec 1 18:45 00000002000000000000000A -rw------- 1 postgres postgres 16777216 Nov 30 21:22 00000002000000000000000B -rw------- 1 postgres postgres 16777216 Dec 1 18:45 00000002000000000000000C -rw------- 1 postgres postgres 83 Dec 1 18:45 00000003.history -bash-4.1$

as per_pg_xlog timeline history file 00000003.history arrived at standby still not starting streaming from new primary.

(由于per_pg_xlog时间轴历史记录文件00000003.history到达备用数据库仍未从新的主数据库开始流式传输。)

Question:- 1. Is it mandatory parameter recover_target_timeline='latest' in recovery.conf file" to get latest timeline id from new primary through streaming to start streaming replication?

(问题: - 1.这是必须的参数recover_target_timeline='latest'recovery.conf文件”,通过流开始流复制摆脱新主最新时间表ID?)

2.If yes, is it for all PostgreSQL Version?

(2.如果是,是否适用于所有PostgreSQL版本?)

like from 9.3 to 11.5

(从9.3到11.5)

  ask by Adam Mulla translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...