Mongodb服务无法在Ubuntu 16.04上启动

时间:2017-09-18 19:09:52

标签: mongodb ubuntu

当我尝试使用命令sudo service mongod start启动mongodb服务时,它不起作用。经过&sudo service mongod status`的仔细检查,发现以下内容:

● 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.1

mongodb用户可以使用以下命令访问\tank\mongo目录:sudo chown -R mongodb:users /tank/mongo

1 个答案:

答案 0 :(得分:1)

事实证明,我应该允许mongodb:mongodb,而不仅仅是那个;子文件夹没有继承权限,因此我必须在配置/tank/mongo/log/mongodb//tank/mongo/mongodb中指定的文件夹级别授予权限。

我留下答案,以防它可能帮助处于类似情况的人。