我尝试升级 Discourse,但收到了以下消息 -
I, [2021-01-21T18:39:25.045454 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
2021-01-21 18:39:32.724 UTC [4051] discourse@discourse LOG: duration: 336.116 ms statement: UPDATE users
SET locale = 'en_GB'
WHERE locale = 'en'
2021-01-21 18:39:33.373 UTC [4051] discourse@discourse ERROR: duplicate key value violates unique constraint "index_users_on_username_lower"
2021-01-21 18:39:33.373 UTC [4051] discourse@discourse DETAIL: Key (username_lower)=(xyz123) already exists.
2021-01-21 18:39:33.373 UTC [4051] discourse@discourse STATEMENT: UPDATE users
SET locale = 'en'
WHERE locale = 'en_US'
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
我尝试执行 ./launcher enter app 和 su postgres -c 'psql discourse',但收到以下错误 -
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
嘿。
当升级失败时,容器会停留在停止状态。(尝试通过浏览器连接您的网站,您会看到确实如此)
因此,您可能只是没有启动最新的工作容器(升级前的版本)。
请执行 ./launcher start app,然后进入容器并尝试进入数据库 CLI。
谢谢,我已经重启了容器,有什么建议吗?我尝试了 ./launcher enter app,还有其他可以试的吗?
ubuntu@:/var/discourse$ ./launcher start app
WARNING: Docker version 17.05.0-ce deprecated …
Nothing to do, your container has already started!
没有报错,但当我运行 ./launcher logs app 时,得到了以下输出:
ok: run: redis: (pid 47) 918s
timeout: down: postgres: 1s, normally up, want up
ok: run: redis: (pid 47) 925s
timeout: down: postgres: 0s, normally up, want up
ok: run: redis: (pid 47) 933s
ok: run: postgres: (pid 1855) 0s
supervisor pid: 1847 unicorn pid: 1857
config/unicorn_launcher: line 71: kill: (1857) - No such process
config/unicorn_launcher: line 15: kill: (1857) - No such process
(1847) exiting
ok: run: redis: (pid 47) 938s
timeout: down: postgres: 0s, normally up, want up
ok: run: redis: (pid 47) 945s
ps -ef | grep postgres 的结果是什么?
我应该是在容器内运行,还是直接在 Linux 主机上运行?
内部。看起来它没有运行。
我怀疑您需要以 postgres 用户身份手动重启它。
你可以尝试:
su - postgres /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main - 将 13 替换为你当前的版本。
这是健康安装过程中宣传的命令。
不过没有保修,因为我尚未测试过!
不,别费心这么做了,请查看下文。
顺便问一下,我想知道你的 13 版本升级过程是否失败了。
如果是的话,你可能想看看这个主题,并考虑在其中发帖:PostgreSQL 13 update
抱歉,看起来这被更高层级的进程包装并管理着。
如果我终止我的进程,它会自动重启。
尝试以 root 身份运行:sv start postgres
你的意思是将其在 Docker 容器中运行吗?谢谢。
是的,服务正在那里运行。
更好的做法是执行:sv restart postgres
然后检查:
tail /var/log/postgres/current
正常状态应显示类似以下内容:
2021-01-21 20:21:10.284 UTC [575368] LOG: database system is ready to accept connections 出现在日志中。