MongoDB Yaml config file Unrecognized Option:Stora

2019-09-19 06:50发布

We are trying to set up mongodb's remote access by using a config file, and are having trouble running the config file in the bin folder. When we put our script through YAML Lint it says its valid, but when we run our file in command prompt it interchanges two errors 1) Unrecognized Option: Storage and 2) Unrecognized Option: SystemLog

This is our config file
storage: 
  dbPath: C:\\data\\db
  enabled: true
systemLog: 
  destination: file
  logAppend: true
  logpath: C:\\data\\log\\mongo.log
net:
  port: 27017
  bindIp: 127.0.0.1  

our command in command prompt is

mongod -f mongo.config.txt

Please Help <3

标签: mongodb cmd yaml
3条回答
Animai°情兽
2楼-- · 2019-09-19 07:22

You have a couple of errors in your config (for MongoDB 3.2):

  • There is no storage.enabled option, I think you meant storage.journal.enabled
  • There is no systemLog.logpath option, this should be systemLog.path

This modified config file seems to work as expected:

storage: 
  dbPath: C:\\data\\db
  journal:
    enabled: true
systemLog: 
  destination: file
  logAppend: true
  path: C:\\data\\log\\mongo.log
net:
  port: 27017
  bindIp: 127.0.0.1  

You can browse for more options in the Configuration File Options page

查看更多
姐就是有狂的资本
3楼-- · 2019-09-19 07:31

This happened with me because I deleted a space in the configuration file.

storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true

I got this error, when the configuration file had the below state, note the gap before enabled:

storage:
  dbPath: /var/lib/mongo
  journal:
  enabled: true
查看更多
SAY GOODBYE
4楼-- · 2019-09-19 07:44

This happen due to invalid yaml syntax. In my case, i missed the space between dbPath and value

Incorrect

storage:
    dbPath:"./data/db"

Correct

storage:
    dbPath: "./data/db"
查看更多
登录 后发表回答