当我尝试使用sudo service mongod start命令启动mongodb服务时,它不起作用。仔细检查'sudo服务神神状态‘,结果如下:
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-09-18 21:00:29 CEST; 7s ago
Docs: https://docs.mongodb.org/manual
Process: 21352 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAIL
Main PID: 21352 (code=exited, status=1/FAILURE)
Sep 18 21:00:29 zeus systemd[1]: Started High-performance, schema-free document-oriented databas
Sep 18 21:00:29 zeus systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAIL
Sep 18 21:00:29 zeus systemd[1]: mongod.service: Unit entered failed state.
Sep 18 21:00:29 zeus systemd[1]: mongod.service: Failed with result 'exit-code'.配置文件已更改为以下内容:
# Where and how to store data.
storage:
dbPath: /tank/mongo/mongodb
journal:
enabled: true
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /tank/mongo/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1mongodb用户可以使用以下命令访问\tank\mongo目录:sudo chown -R mongodb:users /tank/mongo。
发布于 2017-09-19 04:10:33
事实证明,我应该将权限授予mongodb:mongodb,不仅如此;子文件夹没有继承权限,因此我必须在配置/tank/mongo/log/mongodb/、/tank/mongo/mongodb中指定的文件夹级别授予权限。
我留下了答案,以防它可能会帮助处于类似情况的人。
https://stackoverflow.com/questions/46286546
复制相似问题