我按照本教程https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04重新安装了mongo,但它似乎无法启动,这是sudo systemctl status mongodb的结果
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-04-05 16:31:03 UTC; 6s ago
Process: 14024 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 14024 (code=exited, status=1/FAILURE)
Apr 05 16:31:02 nodejs-512mb-fra1-01 systemd[1]: Started High-performance, schema-free document-oriented database.
Apr 05 16:31:03 nodejs-512mb-fra1-01 mongod[14024]: error command line: unrecognized line in 'storage:'
Apr 05 16:31:03 nodejs-512mb-fra1-01 mongod[14024]: use --help for help
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Unit entered failed state.
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Failed with result 'exit-code'
我的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
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
如果我试图注释掉存储,那么它在systemLog行上会出现相同的错误
答案 0 :(得分:0)
错误消息显示'存储中的无法识别的行:' ,检查/etc/mongod.conf
文件中的标签或存储设置附近的任何奇怪/特殊字符。
您还可以在此处验证您的配置文件是否有效YAML: