使用Docker的原因触发了PANIC:找不到有效的检查点记录 [英] Using Docker, what triggered PANIC: could not locate a valid checkpoint record

查看:64
本文介绍了使用Docker的原因触发了PANIC:找不到有效的检查点记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图更好地理解Docker,这样做似乎破坏了我的应用程序的PostgreSQL数据库.

I am trying to understand Docker a little better, and in doing so, it appears I corrupted my PostgreSQL DB for my application.

我正在使用Docker Swarm启动我的应用程序,并且在PostgreSQL容器的循环中遇到以下错误:

I am using Docker Swarm to start my application and I'm getting the following error in a loop in the PostgreSQL Container:

    2021-02-10 15:38:51.304 UTC 120 LOG:  database system was shut down at 2021-02-10 14:49:14 UTC
    2021-02-10 15:38:51.304 UTC 120 LOG:  invalid primary checkpoint record
    2021-02-10 15:38:51.304 UTC 120 LOG:  invalid secondary checkpoint record
    2021-02-10 15:38:51.304 UTC 120 PANIC:  could not locate a valid checkpoint record
    2021-02-10 15:38:51.447 UTC 1 LOG:  startup process (PID 120) was terminated by signal 6
    2021-02-10 15:38:51.447 UTC 1 LOG:  aborting startup due to startup process failure
    2021-02-10 15:38:51.455 UTC 1 LOG:  database system is shut down

最初,我试图通过转到FS中的挂载驱动器来修改容器中的 pg_hba.conf 文件

Initially, I was trying to modify the pg_hba.conf file in the container by going to the mount drive in the FS, which is in

 /var/lib/docker/volumes/postgres96-data-volume/_data

但是,每次我重新启动容器时,对 pg_hba.conf 的更改都会恢复.因此,今天早上,我在mount文件夹中添加了一个名为 test 的虚拟文件,然后重新启动了容器,希望删除该文件以进行直观验证,即重新启动容器会自动将该安装中的所有内容替换为原始格式.再次重新启动之后,我才开始收到那些错误消息,阻止了我的应用程序启动.

However, every time I restarted the container my changes to pg_hba.conf were reverted. So this morning I added a dummy file called test in the mount folder and restarted the container expecting the file to be deleted to get a visual validation that restarting the container automatically replaces everything in that mount to it's original format. After restarting it again, that's when I started getting those error messages preventing my application from starting.

我删除了 test 文件,然后再次重新启动了容器,但是错误消息仍然存在.

I deleted the test file and restarted the container again, but the error message continues.

我阅读了许多解决方案,但我的问题是更多地了解为什么添加文件会导致此问题?是因为我在其中添加了文件,所以卷损坏了吗?

I read many solutions on how to fix it, but my question is more to understand why adding a file would cause that? Is my volume corrupted simply because I added a file in there?

谢谢

推荐答案

此错误表示Postgres卷已损坏.当两个容器尝试同时连接到同一卷时,可能会发生这种情况.有关更多信息,请参见此答案.不知道如何修改文件会损坏驱动器.不过,您需要删除并重新创建该卷.为此,您可以:

This error means the Postgres volume is corrupted. This can happen when two containers try to connect to the same volume at the same time. See this answer for slightly more info. Not sure how modifying a file corrupted the drive. You'll need to delete and recreate the volume though. To do this you can:

$ docker stop <your_container_name> # stops a running container
$ docker image prune # removes all images that are not attached to a container
$ docker volume ls # list out active volumes
$ docker volume rm <volume_name> # Remove the volume that's corrupted

我必须运行以上代码来停止容器,清理某种原因没有附加到任何容器的图像,然后最终删除保存有损坏数据的有问题的卷.

I had to run the above code to stop a container, clean images that somehow weren't attached to any containers and then finally delete the offending volume where corrupted data was held.

这篇关于使用Docker的原因触发了PANIC:找不到有效的检查点记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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