我在使用Ubuntu Server 16.04的服务器上安装了MongoDB 3.6.2。 安装后一切正常。现在我需要在MongoDB上启用auth并且我已经看过该指南并且我已经设置了我的mongod.conf whit securety:authentication:enabled,这是我的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
securety:
authorization: enabled
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
现在,我尝试使用sudo systemtcl restart
重新启动MongoDB,但是当我运行status命令时,MongoDB状态失败并收到此错误:
mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
Active: failed (Result: exit-code) since gio 2018-01-25 13:02:23 CET; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 1409 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited
Main PID: 1409 (code=exited, status=2
如果我评论安全模式,状态将恢复为活动状态。
答案 0 :(得分:1)
使用
security:
authorization: enabled
而不是
securety:
authorization: enabled