LoginSignup
10
11

More than 5 years have passed since last update.

postgresレプリケーション環境でのバックアップ失敗!

Last updated at Posted at 2013-07-11

postgresレプリケーション環境でのバックアップ失敗!

  • postgresのストリーミング・レプリケーションを使ったマスタ・スレーブの2台構成のレプリケーション環境

  • さらに万が一のために、DBのダンプを別のサーバに保存しよう!

  • マスタはアプリケーションで使用してるので負荷かけたくないなと思い、
    スレーブからダンプを取ろう!!

あれ?ダンプが取れない。。。

  • pg_dumpでダンプファイルは途中まで作成されてて、下記エラーが出て処理が止まってしまっていた。
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  canceling statement due to conflict with recovery
DETAIL:  User was holding a relation lock for too long.

検索したら英語のサイトだらけだったけど、要は

スレーブのテーブルロック時間長すぎてレプリケーション止まってるからこの処理止めるな!止めるからな!

ということだった。。。
で、その待ち時間をなが~くする設定が

max_standby_streaming_delay

今回は

max_standby_streaming_delay = -1

で待ち時間を無限に設定して、再度ダンプを取得してちゃんとダンプ取得できました!

10
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
11