在 Ubuntu 22.04.1 上(AMD 3970x 处理器,64GB 内存(memtest86 通过),根文件系统有几 TB 可用空间,没有 SMART 错误),我按照这里的标准说明安装了社区版 mongodb 。在 systemd 中启动 mongod 时,它失败了,并显示以下journalctl -xe
消息:
Apr 01 22:55:52 ganymede systemd[1]: Started MongoDB Database Server.
░░ Subject: A start job for unit mongod.service has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit mongod.service has finished successfully.
░░
░░ The job identifier is 9623.
Apr 01 22:55:52 ganymede sudo[427395]: pam_unix(sudo:session): session closed for user root
Apr 01 22:55:52 ganymede mongod[427399]: {"t":{"$date":"2025-04-02T05:55:52.613Z"},"s":"I", "c":"CONTROL", "id":7484500, "ctx":"main","msg":"Environment variable MONGODB_CONFIG_OVERRIDE_NOFORK == 1, overriding \"processManagem>
Apr 01 22:55:52 ganymede systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit mongod.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 14.
Apr 01 22:55:52 ganymede systemd[1]: mongod.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit mongod.service has entered the 'failed' state with result 'exit-code'.
同一次启动尝试的更多具体错误消息出现在 /var/log/mongodb/mongod.log-
{"t":{"$date":"2025-04-01T22:55:52.617-07:00"},"s":"I", "c":"CONTROL", "id":20698, "ctx":"main","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2025-04-01T22:55:52.620-07:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2025-04-01T22:55:52.620-07:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2025-04-01T22:55:52.621-07:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set at least one of the related parameters","attr":{"relatedParameters":["tcpFastOpenServer","tcpFastOpenClient","tcpFastOpenQueueSize"]}}
{"t":{"$date":"2025-04-01T22:55:52.621-07:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":25},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":25},"outgoing":{"minWireVersion":6,"maxWireVersion":25},"isInternalClient":true}}}
{"t":{"$date":"2025-04-01T22:55:52.632-07:00"},"s":"F", "c":"ASSERT", "id":23095, "ctx":"main","msg":"Fatal assertion","attr":{"msgid":40475,"error":"FailedToParse: failed to parse time zone file for time zone identifier \"Asia/Riyadh87\": The version used in this timezone identifier is unsupported","file":"src/mongo/db/query/datetime/date_time_support.cpp","line":219}}
{"t":{"$date":"2025-04-01T22:55:52.632-07:00"},"s":"F", "c":"ASSERT", "id":23096, "ctx":"main","msg":"\n\n***aborting after fassert() failure\n\n"}
这似乎表明 tzdata 包存在问题,因此我通过几种方式进行了检查-
dpkg --verify tzdata
# 没有错误或输出- 检查
apt
日志,zgrep -i tzdata /var/log/apt/*.gz
昨天(2025 年 3 月 31 日)有更新 - 检查利雅得 tzdata 文件,
find /usr/share/zoneinfo|grep "Riyadh"|xargs -n 1 zdump -v
没有错误消息,尽管其中有几条记录包含“NULL”,但不清楚这是否表示存在问题。
因此,我卸载了该版本(apt remove mongodb-org-server mongodb-org-shell mongodb-org-tools mongodb-org-mongos mongodb-org-database mongodb-org-database-tools-extra mongodb-mongosh mongodb-database-tools
)
然后,我从社区版存档页面下载了 .deb 文件,安装了之前的版本,先后安装了 8.0.5、8.0.4、8.0.3、8.0.1 和 8.0.0。我一个个地安装、启动,检查是否失败——全部失败——/var/log/mongodb/mongod.log 中都出现了相同的错误:“FailedToParse: 无法解析时区标识符为“Asia/Riyadh87”的时区文件”。
这可能是“我的问题”,但 tzdata 中格式不受支持的时区文件不太可能进入 Ubuntu 的仓库,而不影响任何其他服务,也不会立即得到修补。不过,我之前在 Ubuntu 22.04 上遇到过 tzdata 问题,并能够通过 解决apt reinstall
。
我更喜欢在裸机上运行服务,因此我付出了很多努力,如果有人能提供一些建议,我将不胜感激。现在,我会在 Docker 上启动 mongodb,然后咬紧牙关。
更新 - 安装 mongodb-server-org 会添加一个默认的 /etc/mongod.conf,其中包含 -
processManagement:
timeZoneInfo: /usr/local/share/tzdb
我尝试过使用这些行和不使用这些行开始,没有区别,mongod 仍然扫描 Ubuntu 的内置 tzdb 并断言失败。
因此我下载了 tzdb并将其解压到 /usr/local/share/mytzdb,将 mongod.conf 指向该位置,然后启动 mongod - 没有结果,以同样的方式失败。
也许有一个环境变量被覆盖了?目前我在 Docker 下运行,没有问题。
哦,今天早上 Ubuntu 更新刷新了 tzdb,哈哈。不过 mongod 没修复。