PostgreSQL 15 更新

当我访问 https://community.ankihub.net/admin/update 时,看到以下消息:

您正在运行旧版本的 Discourse 镜像
在运行最新镜像之前,Web UI 中的更新功能将被禁用。为此,请使用 SSH 登录到您的服务器并运行:

cd /var/discourse
git pull
./launcher rebuild app

按照上述说明操作后,我收到 UPGRADE OF POSTGRES FAILED(Postgres 升级失败)错误:

invoke-rc.d: 无法确定当前运行级别
invoke-rc.d: policy-rc.d 拒绝执行启动。
正在处理 postgresql-common (267.pgdg120+1) 的触发器...
从已安装的 myspell/hunspell 包构建 PostgreSQL 字典...
删除过时的字典文件:
正在停止 PostgreSQL 13 数据库服务器:main。
正在停止 PostgreSQL 15 数据库服务器:main。
执行一致性检查
-----------------------------
检查集群版本                                   正常
检查数据库用户是否为安装用户                  正常
检查数据库连接设置                            正常
检查预准备事务                                正常
检查用户表中的系统定义复合类型                正常
检查用户表中的 reg* 数据类型                  正常
检查 contrib/isn 与 bigint 传递不匹配的情况   正常
检查用户定义的编码转换                        正常
检查用户定义的后缀运算符                      正常
检查不兼容的多态函数                          正常
创建全局对象的转储                            正常
创建数据库架构的转储
*失败*

请查看 "/shared/postgres_data_new/pg_upgrade_output.d/20250129T103738.877/log/pg_upgrade_dump_16384.log" 的最后几行,
以了解失败的可能原因。
失败,正在退出
-------------------------------------------------------------------------------------
POSTGRES 升级失败

请访问 https://meta.discourse.org/t/postgresql-15-update/349515 寻求支持。
在此期间,您可以运行 ./launcher start app 来重启您的应用
-------------------------------------------------------------------------------------



失败
--------------------
Pups::ExecError: if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi
 执行失败,返回码为 #<Process::Status: pid 18 exit 1>
失败位置:/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
执行失败,参数为 {"tag"=>"db", "cmd"=>"if [ -f /root/install_postgres ]; then\n  /root/install_postgres && rm -f /root/install_postgres\nelif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then\n  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1\nfi\n"}
引导失败,退出代码为 1

这里或 这个 somewhat related topic 中似乎都没有解决我的问题,据我所知。

以下是 /shared/postgres_data_new/pg_upgrade_output.d/20250129T103738.877/log/pg_upgrade_dump_16384.log 中的日志:

command: "/usr/lib/postgresql/15/bin/pg_dump" --host /var/lib/postgresql --port 50432 --username postgres --schema-only --quote-all-identifiers --binary-upgrade --format=custom  --file="/shared/postgres_data_new/pg_upgrade_output.d/20250129T103738.877/dump/pg_upgrade_dump_16384.custom" 'dbname=discourse' >> "/shared/postgres_data_new/pg_upgrade_output.d/20250129T103738.877/log/pg_upgrade_dump_16384.log" 2>&1
pg_dump: 错误:查询失败:错误:无法访问文件 "$libdir/vector":没有那个文件或目录
pg_dump: 详情:查询为:SELECT t.tableoid, t.oid, i.indrelid, t.relname AS indexname, pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, i.indkey, i.indisclustered, c.contype, c.conname, c.condeferrable, c.condeferred, c.tableoid AS contableoid, c.oid AS conoid, pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, (SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, t.reloptions AS indreloptions, i.indisreplident, inh.inhparent AS parentidx, i.indnkeyatts AS indnkeyatts, i.indnatts AS indnatts, (SELECT pg_catalog.array_agg(attnum ORDER BY attnum)   FROM pg_catalog.pg_attribute   WHERE attrelid = i.indexrelid AND     attstattarget >= 0) AS indstatcols, (SELECT pg_catalog.array_agg(attstattarget ORDER BY attnum)   FROM pg_catalog.pg_attribute   WHERE attrelid = i.indexrelid AND     attstattarget >= 0) AS indstatvals, false AS indnullsnotdistinct FROM unnest('{16805,16813,16823,16835,16846,16858,16940,16948,16963,16973,16996,17006,17029,17061,17071,17085,17095,17101,17112,17136,17151,17159,17168,17266,17280,17321,17334,17345,17354,17368,17382,17398,17412,17420,17428,17519,17532,17543,17562,17570,17620,17687,17710,17724,17738,17754,17775,17788,17803,17824,17851,17864,17898,17917,17932,17944,17958,17980,17993,18006,18019,18030,18041,18055,18069,18092,18101,18134,18145,18166,18177,18214,18241,18263,18276,18298,18324,18338,18358,18368,18403,18426,18449,18458,18470,18496,18510,18525,18534,18543,18569,18596,18607,18625,18643,18655,18663,18676,18686,18698,18710,18719,18734,18742,18757,18768,18786,18798,18802,18806,18846,18864,18879,18891,18910,18920,18932,18946,18988,19003,19014,19039,19059,19073,19085,19097,19103,19116,19140,19192,19206,19227,19250,19266,19300,19309,19328,19343,19354,19367,19389,19402,19417,19430,19497,19521,19544,19559,19569,19597,19605,19637,19687,19703,19721,19742,19771,19807,19821,19830,19839,19862,19874,19890,19904,19917,19932,19942,19951,19960,19981,20005,20021,20044,20052,20061,20073,20082,20133,20146,20157,20178,20191,20203,20217,20231,20263,20276,20297,20309,20320,28805,28951,28964,28976,28986,28997,32824,32833,32843,32852,32862,32875,32887,32899,32910,32930,32967,35131,35141,38401,38413,38437,38445,38461,38482,38495,42870,46125,46138,130133,191445,191457,191471,191486,191497,191603,191637,243875,606663,606675,606693,606707,779182,779197,779213,779225,779237,779252,779265,968985,968993,969004,969017,969027,1004239,1004251,1004263,1004276,1004295,1091838,1091849,1091860,1336877,1336884,1336891,1566392,2169846,2169852,2169858,2169864,2169870,2169876,2169882,2169888,2169894,2169900,2169906,2169912,2169918,2169924,2169930,2169936,2169942,2169948,2169954,2169960,2169966,2169972,2169978,2169984}'::pg_catalog.oid[]) AS src(tbloid)
JOIN pg_catalog.pg_index i ON (src.tbloid = i.indrelid) JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) JOIN pg_catalog.pg_class t2 ON (t2.oid = i.indrelid) LEFT JOIN pg_catalog.pg_constraint c ON (i.indrelid = c.conrelid AND i.indexrelid = c.conindid AND c.contype IN ('p','u','x')) LEFT JOIN pg_catalog.pg_inherits inh ON (inh.inhrelid = indexrelid) WHERE (i.indisvalid OR t2.relkind = 'p') AND i.indisready ORDER BY i.indrelid, indexname
/shared/postgres_data_new/pg_upgrade_output.d/20250129T103738.877/log/pg_upgrade_dump_16384.log

以下是 ./discourse-doctor输出

./discourse-doctor 输出
DISCOURSE DOCTOR 2025 年 1 月 29 日 星期三 上午 10:39:42 UTC
操作系统:Linux forum 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


找到 containers/app.yml

==================== YML 设置 ====================
DISCOURSE_HOSTNAME=community.ankihub.net
SMTP_ADDRESS=smtp.mailgun.org
DEVELOPER_EMAILS=已隐藏 
SMTP_PASSWORD=已隐藏 
SMTP_PORT=587
SMTP_USER_NAME=postmaster@mg.ankihub.net
LETSENCRYPT_ACCOUNT_EMAIL=已隐藏 

==================== DOCKER 信息 ====================
DOCKER 版本:Docker version 27.2.1, build 9e34c9b

DOCKER 进程 (docker ps -a)

CONTAINER ID   IMAGE                           COMMAND        CREATED         STATUS          PORTS                                                                      NAMES
37e2430e1014   local_discourse/app             "/sbin/boot"   4 个月前        运行 33 秒      0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   app
260f4c0ed417   local_discourse/mail-receiver   "/sbin/boot"   20 个月前       运行 4 个月     0.0.0.0:25->25/tcp, :::25->25/tcp                                          mail-receiver


Discourse 容器 app 正在运行


==================== 插件 ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-assign.git
          - git clone https://github.com/discourse/discourse-templates.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-reactions.git
          - git clone https://github.com/discourse/discourse-chat-integration.git
          - git clone https://github.com/discourse/discourse-code-review.git
          - git clone https://github.com/discourse/discourse-topic-voting.git
          - git clone https://github.com/discourse/discourse-automation.git
          - git clone https://github.com/discourse/discourse-bbcode-color.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
          - git clone https://github.com/discourse/discourse-docs.git
          - git clone https://github.com/discourse/discourse-ai.git
          - git clone https://github.com/discourse/discourse-jira.git

未检测到非官方插件。

官方列表请参见 https://github.com/discourse/discourse/blob/main/lib/plugin/metadata.rb。

========================================
community.ankihub.net 上的 Discourse 版本:Discourse 3.4.0.beta2 
localhost 上的 Discourse 版本:Discourse 3.4.0.beta2 


==================== 内存信息 ====================
操作系统:Linux
RAM (MB): 4127

              total        used        free      shared  buff/cache   available
Mem:           3936        1567         158         274        2209        1802
Swap:          2047          67        1980

==================== 磁盘空间检查 ====================
---------- 操作系统磁盘空间 ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        78G   50G   28G  65% /

---------- 容器磁盘空间 ----------
Filesystem      Size  Used Avail Use% Mounted on
overlay          78G   50G   28G  65% /
/dev/vda1        78G   50G   28G  65% /shared
/dev/vda1        78G   50G   28G  65% /var/log

==================== 磁盘信息 ====================
Disk /dev/loop0: 55.68 MiB, 58363904 bytes, 113992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 91.85 MiB, 96292864 bytes, 188072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 63.71 MiB, 66789376 bytes, 130448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 63.10 MiB, 67080192 bytes, 131016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 44.45 MiB, 46596096 bytes, 91008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 91.9 MiB, 96346112 bytes, 188176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop7: 44.3 MiB, 46448640 bytes, 90720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/vda: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2ED04D82-BA1D-4A75-86B9-9553B7EA5228

Device      Start       End   Sectors  Size Type
/dev/vda1  227328 167772126 167544799 79.9G Linux filesystem
/dev/vda14   2048     10239      8192    4M BIOS boot
/dev/vda15  10240    227327    217088  106M Microsoft basic data

分区表条目未按磁盘顺序排列。


Disk /dev/loop8: 55.37 MiB, 58052608 bytes, 113384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

==================== 结束磁盘信息 ====================

==================== 邮件测试 ====================
要进行稳健测试,请从 http://www.mail-tester.com/ 获取一个地址。
邮件测试已跳过。

==================== 完成! ====================

希望有人能指出正确的方向。谢谢!

1 个赞