Mongod:/ data / db未找到。,终止

时间:2019-02-01 11:01:40

标签: mongodb

我有一个奇怪的问题:

当我输入shell时:$ mongod 我收到此错误:

NonExistentPath: Data directory /data/db not found., terminating

在mongod.conf文件中,我将 dbPath 定义为:

/var/lib/mongodb

所以我不确定为什么选择选择其他地方?

当我跑步时:$ mongod --config /etc/mongod.conf 我收到此错误: F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"

无论如何,运行mongo都可以,并且我可以访问我的数据库,但是我担心以后可能会遇到问题。那么有什么线索可以解决所有问题吗?

mongod.conf:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

1 个答案:

答案 0 :(得分:0)

在conf文件中设置的默认值的任何更改都将保证服务重启。您将必须运行sudo service mongod restart

该主题有一个存在的线程-https://dba.stackexchange.com/questions/205412/mongodb-failed-global-initialization-failed-to-open-var-log-mongodb-mongo