10

devel データベース ノード (このノードは RAM や CPU が少なく、実稼働サーバーよりも少ない) で大規模なデータベース (カスタム形式でほぼ 32Go) を復元しようとすると、少し問題が発生しました。

データベース ダンプは、次のようなコマンドで生成されます。

pg_dump -F custom -b myDB -Z 9 > /backup/myDB-`date +%y%m%d`.pg91

そして、復元するときは、次のコマンドを使用しました。

pg_restore -F custom -j 5 -d myDB /backup/myDB-20130331.pg91

しかし、ここでは、復元コマンドが次のようなエラーで失敗するたびに:

pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the connection unexpectedly
This probably means the server terminated abnormally
    before or while processing the request.
pg_restore: [archiver] worker process failed: exit code 1
pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the connection unexpectedly
This probably means the server terminated abnormally
    before or while processing the request.
pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the connection unexpectedly
This probably means the server terminated abnormally
    before or while processing the request.
pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the connection unexpectedly
This probably means the server terminated abnormally
    before or while processing the request.

そして、postgresql ログを確認すると、次のように表示されます。

   HINT:  In a moment you should be able to reconnect to the database and repeat your command.
   LOG:  all server processes terminated; reinitializing
   LOG:  database system was interrupted; last known up at 2013-04-02 11:41:48 UTC
   LOG:  database system was not properly shut down; automatic recovery in progress
   LOG:  redo starts at 86/26F302B0
   LOG:  unexpected pageaddr 85/E3F52000 in log file 134, segment 38, offset 16064512
   LOG:  redo done at 86/26F51FC0
   LOG:  last completed transaction was at log time 2013-04-02 11:50:47.663599+00
   LOG:  database system is ready to accept connections
   LOG:  autovacuum launcher started

かなり奇妙です。復元しただけで、postgresql サーバーが単独で「再起動」します。ジョブの数を最小限に抑えようとしましたが (-j 5オプション)、それでも同じ問題が発生しました。ただし、より優れたスペックのノードでは、このデータベースを復元するのに問題はありません。よくわかりませんが、インデックスの更新 (そのうちの 1 つが非常に大きすぎる) が、この問題を理解する手がかりになるのでしょうか?

いくつか質問があります。非常に大きなデータベースを復元するためのより良い方法はありますか? pg_restore コマンドに何か不足がありますか? 開発サーバーの設定が低すぎるのでしょうか?

手がかりは大歓迎です。少し早いですがお礼を。

env: PostgreSQL 9.1 (Debian パッケージ経由でインストール)

4

1 に答える 1

14

この種の大きな作業の場合、復元プロセス中に( postgresql.confautovacuumに設定して) を無効にすることをお勧めしoffます。

それは最終的に私のために働くようです。

于 2013-04-12T08:56:58.823 に答える