在mongod.conf上打开认证时无法启动mongodb

问题描述:

我在/etc/mongod.conf中取消注释“security:authorization:enabled”选项时无法启动mongod?在mongodb上的 3.4.2 在centos6.5;在mongod.conf上打开认证时无法启动mongodb

这是commond打印出来:

sudo service mongod restart 
Stopping mongod:           [ OK ] 
Starting mongod:           [FAILED] 

这是我的mongod.conf文件: 这里是commond打印出来:

# mongod.conf 

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

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

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

# how the process runs 
processManagement: 
    fork: true # fork and run in background 
    pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile 

# network interfaces 
net: 
    port: 58018 
    bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces. 

#security:    <---uncomment here will start failed 
# authorization:enabled <---uncomment here will start failed 
#operationProfiling: 

#replication: 

#sharding: 

## Enterprise-Only Options 

#auditLog: 

#snmp: 

一切都还好你只是缺少空间之前启用关键字。空间是非常重要的前启用

```

security: 
    authorization: enabled 

```

与安全上面的代码替换您的片段。 很难找到并希望能帮助某人。