我在尝试启动mongo deamon时遇到此错误。
CONTROL〔main〕全局初始化失败:FileRename失败:无法不重命名预先存在的日志文件"var/lib/mongodb/log/mongod.log";到"var/lib/mongodb/log/mongod.log.2011-12-02T14-32-24";;跑带--logappend或手动删除文件:权限被拒绝
配置
storage:
dbPath: "/var/lib/mondodb/data"
systemLog:
destination: file
path: "/var/lib/mongodb/log/mongod.log"
CCD_ 1拥有CCD_ 2和子目录的所有权。权限应该是可以的。
mondodb目录
drwxr-xr-x 2 mongodb mongodb 4096 Dec 2 15:42 config
drwxr-xr-x 2 mongodb mongodb 4096 Dec 2 15:41 data
drwxr-xr-x 2 mongodb mongodb 4096 Dec 2 15:42 log
服务本身不会运行任何
> sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-12-06 17:09:38 GMT; 1s ago
Docs: https://docs.mongodb.org/manual
Process: 24234 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 24234 (code=exited, status=100)
Dec 06 17:09:37 GEL-R90VQK84 systemd[1]: Started MongoDB Database Server.
Dec 06 17:09:38 GEL-R90VQK84 systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
Dec 06 17:09:38 GEL-R90VQK84 systemd[1]: mongod.service: Failed with result 'exit-code'.
您是以root身份运行deamon吗?
检查文件的所有权
/var/lib/mongodb/log/mongod.log