我关注了官方文档中的说明,但是在检查进程状态时出现以下错误:
imperium@imperium:~$ sudo systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Wed 2021-11-03 18:58:22 UTC; 16min ago
Docs: https://docs.mongodb.org/manual
Process: 2405 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=dumped, signal=ILL)
Main PID: 2405 (code=dumped, signal=ILL)
nov 03 18:58:22 imperium systemd[1]: Started MongoDB Database Server.
nov 03 18:58:22 imperium systemd[1]: mongod.service: Main process exited, code=dumped, status=4/ILL
nov 03 18:58:22 imperium systemd[1]: mongod.service: Failed with result 'core-dump'.
imperium@imperium:~$
这是 Ubuntu 服务器的全新安装。我该如何修复此问题?
我尝试过
sudo chown -R mongodb:mongodg /var/log/mongodb
sudo chown -R mongodb:mongodg /var/lib/mongodb
sudo chmod -R 755 /var/lib/mongodb
sudo chmod -R 755 /var/log/mongodb
sudo systemctl restart mongod.service
结果相同。
sudo mongod --repair --dbpath /var/lib/mongod
> Illegal instruction
imperium@imperium:~$ dmesg | grep mong
[ 31.638118] traps: mongod[627] trap invalid opcode ip:565454367a9a sp:7ffc8668ba80 error:0 in mongod[565450400000+5090000]
答案1
我发现这个答案:
MongoDB 5.0 需要 Sandy Bridge 或更新的 CPU。获取更新的处理器或使用旧版本的 MongoDB。 https://jira.mongodb.org/browse/SERVER-54407
将我的 VM 恢复到 Mongo 5 安装之前的快照并安装 mongodb 4.4,现在可以正常工作。