简体   繁体   中英

MongoDB Yaml config file Unrecognized Option:Storage

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

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

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM