1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails Dockerでpostgresが起動しなくなった時の対処メモ

Last updated at Posted at 2019-06-14

概要

dockerでpostgresが今まで起動してたのに急に起動しなくなった。

エラー

docker-compose up すると下記エラーが出て失敗する。

db_1   | 2019-06-14 05:53:38.017 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2019-06-14 05:53:38.017 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2019-06-14 05:53:38.023 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2019-06-14 05:53:38.152 UTC [22] LOG:  database system was shut down at 2019-06-14 04:25:59 UTC
db_1   | 2019-06-14 05:53:38.158 UTC [22] LOG:  invalid primary checkpoint record
db_1   | 2019-06-14 05:53:38.158 UTC [22] PANIC:  could not locate a valid checkpoint record
db_1   | 2019-06-14 05:53:38.159 UTC [1] LOG:  startup process (PID 22) was terminated by signal 6: Aborted
db_1   | 2019-06-14 05:53:38.159 UTC [1] LOG:  aborting startup due to startup process failure
db_1   | 2019-06-14 05:53:38.162 UTC [1] LOG:  database system is shut down
docker-rails-db_1 exited with code 1

原因

PANIC: could not locate a valid checkpoint recordのエラーでWALログ(pg_xlog) が壊れたらしい。

対処法

データベースのデータを全削除しました。 その後docker-compose buildし直しました。
例:docker-compose.ymのdb > volumesのパスのファイルを全削除

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?