FATAL:锁定文件“postmaster.pid”为空

这是我重建时第一次看到以下错误。

2022-10-04 14:39:49.780 UTC [1700] FATAL:  lock file "postmaster.pid" is empty
2022-10-04 14:39:49.780 UTC [1700] HINT:  Either another server is starting, or the lock file is the remnant of a previous server startup crash.

我显然可以读懂提示,但不确定如何进行。有人能提供一些见解吗?

这是什么时候发生的?这是标准安装吗?

标准安装,并在执行 ./launcher rebuild app 后

也许可以试试
./launcher start app

这之前奏效吗?

这是错误还是警告。你试过在浏览器中打开吗?

什么显示

 docker ps

Response to ./launcher start app:

57c2a0746e93
Nothing to do, your container has already started!

然后我在浏览器中收到 502 Bad Gateway。

docker ps 输出

CONTAINER ID   IMAGE                 COMMAND        CREATED        STATUS          PORTS                                                                                                                 NAMES
57c2a0746e93   local_discourse/app   “/sbin/boot”   6 months ago   Up 16 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp   app

这很奇怪。我想我可能会重启并重新构建。

或者也许

   ./launcher stop app; ./launcher rebuild app

您正在运行一个旧容器,而不是刚刚构建的(6个月前创建的)容器。

而且重新构建过程中可能还有其他您没有注意到的错误。

相同的结果

2022-10-04 15:26:43.452 UTC [1699] FATAL:  lock file "postmaster.pid" is empty
2022-10-04 15:26:43.452 UTC [1699] HINT:  Either another server is starting, or the lock file is the remnant of a previous server startup crash.

这里没有足够的数据来调试。

发生这种情况是因为构建过程认为 PG 已经在运行,所以 PG 升级过程可能有些不对劲。你能包含启动器的完整日志(去除密码)以便我们查看情况吗?

也许看看一个正常工作的系统会有帮助。我在这里看到了我的锁文件:

# ls -l /var/discourse/shared/standalone/postgres_data/postmaster.pid
-rw------- 1 systemd-resolve input 92 Nov 15 16:20 /var/discourse/shared/standalone/postgres_data/postmaster.pid

11 月 15 日是我上次启动应用程序的日期。如果我进入应用程序,可以看到 postgres 进程:

# cd /var/discourse/
# ./launcher enter app
x86_64 arch detected.
# ps auxfc|egrep -1 postm
root        45  0.0  0.0   2332     0 ?        S    Nov15   0:00      \_ svlogd
postgres    48  0.0  0.1 213160  1784 ?        S    Nov15   0:27      \_ postmaster
postgres    67  0.0  2.6 213380 26924 ?        Ss   Nov15   0:34          \_ postmaster
postgres    68  0.0  0.4 213292  4236 ?        Ss   Nov15   0:15          \_ postmaster
postgres    69  0.0  0.1 213160  1068 ?        Ss   Nov15   3:44          \_ postmaster
postgres    70  0.0  0.1 213840  1520 ?        Ss   Nov15   0:16          \_ postmaster
postgres    71  0.0  0.0  68184   380 ?        Ss   Nov15   0:56          \_ postmaster
postgres    72  0.0  0.0 213716   468 ?        Ss   Nov15   0:00          \_ postmaster
postgres    92  0.0  0.0 225364   324 ?        Ss   Nov15   0:01          \_ postmaster
postgres   176  0.0  0.1 217944  1484 ?        Ss   Nov15   0:01          \_ postmaster
postgres  9126  0.0  0.7 215052  7336 ?        Ss   Nov16   0:19          \_ postmaster
postgres  1574  0.0  5.7 223540 58300 ?        Ss   17:28   0:00          \_ postmaster
postgres  1973  0.0  3.3 221032 33960 ?        Ss   17:34   0:00          \_ postmaster
postgres  2320  0.1  3.5 218080 36120 ?        Ss   17:39   0:00          \_ postmaster
postgres  2321  0.1  2.9 218068 29928 ?        Ss   17:39   0:00          \_ postmaster
postgres  2336  0.0  1.4 215052 14340 ?        Ss   17:40   0:00          \_ postmaster
# exit

如果我停止了应用程序,我期望在该位置看不到锁文件,并且没有 postgres 进程在运行。(当然,我需要在主机上直接运行 ps 命令,因为容器将不再运行。)

在您的情况下,我认为我首先会这样做:停止应用程序并检查没有 postgres 进程在运行。似乎有可能您有两个实例在运行,它们之间发生了冲突。

不太可能,但也有可能磁盘已满,这就是为什么锁文件为空。或者可能存在某种权限问题。

编辑:在容器内,锁文件具有不同的位置和所有权:

# ./launcher enter app
x86_64 arch detected.
# ls -l /shared/postgres_data/postmaster.pid
-rw------- 1 postgres postgres 92 Nov 15 16:20 /shared/postgres_data/postmaster.pid
# exit
logout
# 

正如 Sam 指出的,我们需要看到更多信息。

1 个赞