首页 > 解决方案 > 编辑 .conf 文件后 Mongodb 状态失败

问题描述

admin我想通过在数据库中创建用户来启用安全性。然后我创建了该用户,然后我将编辑 mongodb conf 文件。之后,我在连接时遇到了一些问题,我无法与外壳连接。谷歌后,我找到了一个接受答案的问题。我关注了这个问题并做了答案中给出的所有事情,然后在连接 mongo shell 时仍然面临问题。我正在粘贴 mongo 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:
  security.authorization: enabled
#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

标签: mongodb

解决方案


security:
    authorization: enabled

应该没事。并且不要忘记重新启动服务器。


推荐阅读