Docker Postgres无效的主要检查点记录 [英] Docker postgres invalid primary checkpoint record

查看:108
本文介绍了Docker Postgres无效的主要检查点记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在具有持久性数据存储的Docker(在Windows上)上运行postgres,并认为我终于有了它,但是现在当我尝试启动容器时,出现以下错误:

  LOG:无效的主要检查点记录日志:无效的辅助检查点记录PANIC:找不到有效的检查点记录 

这里是我启动容器并开始运行的地方:

  docker卷创建ct_data泊坞窗运行--name postgres_ct -v ct_data:/var/lib/postgresql/data -p 5432:5432 postgres 

然后我使用pgAdmin连接到它,创建了一个新表,并使用restore选项导入了一个postgres转储文件.数据加载没有问题.我使用与上述相同的体积启动了另一个容器,但是使用不同的名称和端口号进行测试,并且能够连接,所以我将其关闭.

现在,一个小时后,我发现我原来的容器已自动停止,因此我尝试将其重新启动并得到上面的错误.这是我第一次使用Docker,因此很可能在这里遗漏了一些简单的东西.

解决方案

感谢@Matt的帮助,我弄清楚了发生了什么.当我同时将两个容器连接到该卷时,该卷(又称postgres数据库)已损坏.

虽然可以允许多个容器连接到单个数据库容器,但不能通过共享卷来连接.您将需要创建一个新容器来运行postgres守护程序,然后其他容器可以通过tcp套接字连接到它.有关如何执行此操作的更多信息,请阅读文档

I've been trying to get postgres running in Docker (on Windows) with a persistent data storage and thought I finally had it, but now when I try to start up my container I get the following errors:

LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record

Here's I got my container up and running to start with:

docker volume create ct_data
docker run --name postgres_ct -v ct_data:/var/lib/postgresql/data -p 5432:5432 postgres

I then connected to it using pgAdmin, created a new table, and imported a postgres dump file using the restore option. The data loaded without issue. I started a second container using the same volume as above, but with a different name and port number to test it and I was able to connect, so I shut it down.

Now, an hour later, I found my original container was stopped automatically so I tried to start it back up and got the errors above. This is my first attempt at using Docker, so it's very possible I'm missing something simple here.

解决方案

Thanks to the help of @Matt I figured out what happened. The volume (aka postgres database) became corrupted as soon as I connected two containers to it at the same time.

It is possible though to allow multiple containers to connect to a single database container, but not by sharing volumes. You would need to create a new container that would run the postgres daemon and then other containers can connect to it via tcp sockets. For more information on how to do this read the docs

这篇关于Docker Postgres无效的主要检查点记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆