Postgresql

在恢復時備份熱備用數據庫(流式複制)

  • May 12, 2016

同步流複製在主數據庫和熱備用數據庫之間設置。

在備用數據庫上執行每日備份以避免主數據庫上的任何性能問題似乎是一個好主意。

備用數據庫的備份已使用 pg_basebackup 成功恢復。存檔的 WAL 文件在本地傳輸,並且在 recovery.conf 中添加了 restore_command 以指向它們 - 在啟動數據庫時,日誌文件中記錄了以下錯誤:

cp: cannot stat ‘/archivedir/wal_arch/00000002.history’: No such file or directory 2016-05-12 17:33:52 BST LOG: starting archive recovery cp: cannot stat ‘/archivedir/wal_arch/0000000100000000000000E7’: No such file or directory 2016-05-12 17:33:52 BST LOG: redo starts at 0/E7000CA0 2016-05-12 17:33:52 BST LOG: consistent recovery state reached at 0/E7000D80 2016-05-12 17:33:52 BST LOG: invalid resource manager ID 100 at 0/E7000D80 2016-05-12 17:33:52 BST LOG: redo done at 0/E7000D48 cp: cannot stat ‘/archivedir/wal_arch/0000000100000000000000E7’: No such file or directory cp: cannot stat ‘/archivedir/wal_arch/00000002.history’: No such file or directory 2016-05-12 17:33:52 BST LOG: selected new timeline ID: 2 cp: cannot stat ‘/archivedir/wal_arch/00000001.history’: No such file or directory 2016-05-12 17:33:52 BST LOG: archive recovery complete 2016-05-12 17:33:52 BST LOG: MultiXact member wraparound protections are now enabled 2016-05-12 17:33:52 BST LOG: database system is ready to accept connections 2016-05-12 17:33:52 BST LOG: autovacuum launcher started

備份備用數據庫而不是主數據庫是個好主意嗎?

是的,這可能是個好主意。事實上,允許這樣做是 PostgreSQL 9.2 版本中的一個主要特性。

引用自:https://dba.stackexchange.com/questions/138369