亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Postgresql流復制切換的時候遇到的一個小問題

發布時間:2020-03-08 01:01:07 來源:網絡 閱讀:1449 作者:李石巖 欄目:數據庫

Pg10搭建了流復制主備切換

配置
主庫10.10.10.13 pghost4
備庫10.10.10.14 pghost5

測試主庫出現問題,停止后,備庫自動切換成為新主庫。老主庫現在應該是備庫了,啟動它驗證狀態。發現備庫啟動不起來。通過以下方法,備庫啟動了。

  1. 新備庫通過pg_ctl start啟動,出現告警日志。

[root@pghost4 ~]# su - pg10
pg10@pghost4->pg_ctl start
waiting for server to start....2019-12-20 21:44:10.004 CST [23416] LOG: listening on IPv4 address "0.0.0.0", port 1921
2019-12-20 21:44:10.004 CST [23416] LOG: listening on IPv6 address "::", port 1921
2019-12-20 21:44:10.006 CST [23416] LOG: listening on Unix socket "/tmp/.s.PGSQL.1921"
2019-12-20 21:44:10.014 CST [23417] LOG: database system was shut down in recovery at 2019-12-20 21:33:31 CST
2019-12-20 21:44:10.014 CST [23417] LOG: entering standby mode
2019-12-20 21:44:10.014 CST [23417] FATAL: requested timeline 2 is not a child of this server's history
2019-12-20 21:44:10.014 CST [23417] DETAIL: Latest checkpoint is at 0/11000028 on timeline 1, but in the history of the requested timeline, the server forked off from that timeline at 0/C000098.
2019-12-20 21:44:10.015 CST [23416] LOG: startup process (PID 23417) exited with exit code 1
2019-12-20 21:44:10.015 CST [23416] LOG: aborting startup due to startup process failure
2019-12-20 21:44:10.016 CST [23416] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Examine the log output.

從上邊的意思可以看到,新備庫pg_wal目錄下的00000002.history 這個跟新主庫不一致。

pg10@pghost4->ll
total 273M
-rw------- 1 pg10 pg10 16M Dec 18 22:40 000000010000000000000001
-rw------- 1 pg10 pg10 16M Dec 18 23:01 000000010000000000000002
-rw------- 1 pg10 pg10 16M Dec 18 23:02 000000010000000000000003
-rw------- 1 pg10 pg10 16M Dec 18 23:06 000000010000000000000004
-rw------- 1 pg10 pg10 16M Dec 18 23:39 000000010000000000000005
-rw------- 1 pg10 pg10 16M Dec 18 23:51 000000010000000000000006
-rw------- 1 pg10 pg10 16M Dec 18 23:55 000000010000000000000007
-rw------- 1 pg10 pg10 16M Dec 18 23:58 000000010000000000000008
-rw------- 1 pg10 pg10 16M Dec 19 00:15 000000010000000000000009
-rw------- 1 pg10 pg10 16M Dec 19 00:15 00000001000000000000000A
-rw------- 1 pg10 pg10 16M Dec 19 00:27 00000001000000000000000B
-rw------- 1 pg10 pg10 16M Dec 19 00:29 00000001000000000000000C
-rw------- 1 pg10 pg10 16M Dec 19 00:34 00000001000000000000000D
-rw------- 1 pg10 pg10 16M Dec 19 00:36 00000001000000000000000E
-rw------- 1 pg10 pg10 16M Dec 19 00:36 00000001000000000000000F
-rw------- 1 pg10 pg10 302 Dec 19 00:36 00000001000000000000000F.00000028.backup
-rw------- 1 pg10 pg10 16M Dec 19 00:38 000000010000000000000010
-rw------- 1 pg10 pg10 16M Dec 20 21:33 000000010000000000000011
-rw------- 1 pg10 pg10 41 Dec 19 00:30 00000002.history
drwx------ 2 pg10 pg10 4.0K Dec 20 21:31 archive_status
pg10@pghost4->more 00000002.history
1 0/C000098 no recovery target specified
pg10@pghost4->

然后看新主庫該路徑下的目錄

pg10@pghost4->ll
total 132K
-rw------- 1 pg10 pg10 206 Dec 19 00:36 backup_label.old
drwx------ 5 pg10 pg10 4.0K Dec 19 00:36 base
drwx------ 2 pg10 pg10 4.0K Dec 20 21:27 global
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_commit_ts
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_dynshmem
-rw------- 1 pg10 pg10 4.6K Dec 19 00:36 pg_hba.conf
-rw------- 1 pg10 pg10 1.6K Dec 19 00:36 pg_ident.conf
drwx------ 4 pg10 pg10 4.0K Dec 19 00:38 pg_logical
drwx------ 4 pg10 pg10 4.0K Dec 19 00:36 pg_multixact
drwx------ 2 pg10 pg10 4.0K Dec 19 00:37 pg_notify
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_replslot
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_serial
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_snapshots
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_stat
drwx------ 2 pg10 pg10 4.0K Dec 20 21:48 pg_stat_tmp
drwx------ 2 pg10 pg10 4.0K Dec 19 00:38 pg_subtrans
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_tblspc
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_twophase
-rw------- 1 pg10 pg10 3 Dec 19 00:36 PG_VERSION
drwx------ 3 pg10 pg10 4.0K Dec 19 00:38 pg_wal
drwx------ 2 pg10 pg10 4.0K Dec 19 00:36 pg_xact
-rw------- 1 pg10 pg10 88 Dec 19 00:36 postgresql.auto.conf
-rw------- 1 pg10 pg10 23K Dec 19 00:36 postgresql.conf
-rw------- 1 pg10 pg10 31 Dec 19 00:37 postmaster.opts
-rw------- 1 pg10 pg10 74 Dec 19 00:38 postmaster.pid
-rw-r--r-- 1 pg10 pg10 5.8K Dec 19 00:37 recovery.done
pg10@pghost4->cd pg_wal/pg10@pghost4->ll
br/>pg10@pghost4->ll
-rw------- 1 pg10 pg10 16M Dec 19 00:36 00000001000000000000000F
-rw------- 1 pg10 pg10 16M Dec 19 00:38 000000010000000000000010
-rw------- 1 pg10 pg10 16M Dec 19 00:38 000000010000000000000011.partial
-rw------- 1 pg10 pg10 16M Dec 19 00:38 000000020000000000000011
-rw------- 1 pg10 pg10 42 Dec 19 00:38 00000002.history
drwx------ 2 pg10 pg10 4.0K Dec 19 00:38 archive_statuspg10@pghost4->pwd
br/>pg10@pghost4->pwd
pg10@pghost4->more 00000002.history
1 0/11000098 no recovery target specified

將新備庫的00000002.history 備份,然后刪除。
將新主庫的傳遞到新備庫。
然后啟動。
pg10@pghost4->scp 00000002.history 10.10.10.13:/data/pg10/data/pg_wal/
pg10@10.10.10.13's password:
00000002.history 100% 42 0.0KB/s 00:00
pg10@pghost4->

pg10@pghost4->pg_ctl start
waiting for server to start....2019-12-20 21:51:25.142 CST [23486] LOG: listening on IPv4 address "0.0.0.0", port 1921
2019-12-20 21:51:25.142 CST [23486] LOG: listening on IPv6 address "::", port 1921
2019-12-20 21:51:25.144 CST [23486] LOG: listening on Unix socket "/tmp/.s.PGSQL.1921"
2019-12-20 21:51:25.155 CST [23487] LOG: database system was shut down in recovery at 2019-12-20 21:33:31 CST
2019-12-20 21:51:25.155 CST [23487] LOG: entering standby mode
2019-12-20 21:51:25.171 CST [23487] LOG: consistent recovery state reached at 0/11000098
2019-12-20 21:51:25.171 CST [23487] LOG: invalid record length at 0/11000098: wanted 24, got 0
2019-12-20 21:51:25.171 CST [23486] LOG: database system is ready to accept read only connections
2019-12-20 21:51:25.179 CST [23491] LOG: started streaming WAL from primary at 0/11000000 on timeline 2
2019-12-20 21:51:25.225 CST [23487] LOG: redo starts at 0/11000098
done
server started
pg10@pghost4->

發現已經啟動。

pg10@pghost4->pg_controldata|grep cluster
Database cluster state: in archive recovery
pg10@pghost4->

可以看到新備庫處于備庫模式。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

正宁县| 平原县| 晋宁县| 鸡西市| 桦甸市| 翁牛特旗| 思南县| 儋州市| 临武县| 牡丹江市| 赫章县| 定兴县| 镇原县| 滨海县| 广河县| 建昌县| 渝中区| 财经| 宿松县| 长汀县| 新安县| 镇雄县| 泾川县| 贡山| 察哈| 徐水县| 伊宁市| 凯里市| 海南省| 靖江市| 达尔| 绵阳市| 江阴市| 通辽市| 永仁县| 电白县| 武川县| 北海市| 永清县| 资源县| 喀什市|