Domanda

I am running Mongo DB version 2.6 on Windows Server 2012. I am having trouble setting up the YAML config file for for security and authorization. When I have the below config file I only receive an error saying "Unrecognized option: security". What is wrong with my config?

mongod_test.conf:

security:
    authorization: enabled
    authenticationMechanisms: MONGODB-CR
storage:
   dbPath: F:\MongoData

Command line:

mongod.exe --config mongod_test.conf

I've added spaces back to my file and that fixes part of the problem. With the updated config from above the current error I am getting is:

c:\MongoDBFolder\bin>mongod.exe --config mongod_test.conf
    Unrecognized option: security.authenticationMechanisms
    try 'mongod.exe --help' for more information
È stato utile?

Soluzione

Can't speak for your exact config, but Yaml requires colon+space to separate the keys and values, otherwise you'll get parse errors;

security:
    authorization: enabled
    authenticationMechanisms: MONGODB-CR
storage:
   dbPath: F:\MongoData

Altri suggerimenti

The error:

Unrecognized option: security.authenticationMechanisms

is because authenticationMechanisms is not part of the "security" configuration.

As per the documentation: http://docs.mongodb.org/manual/reference/configuration-options/#security

However, authenticationMechanisms is an option for "setParameter", as per this documentation:

http://docs.mongodb.org/manual/reference/parameters/#param.authenticationMechanisms

I find the documentation convoluted and confusing, but I've not found anything to contradict this, yet.

So, given the above, I think you should be looking at the following:

security:
   authorization: enabled
setParameter:
   authenticationMechanisms: MONGODB-CR    
storage:
  dbPath: "F:\MongoData"

Can you ensure there is a space after ":" for the key-value pair lines and also enclose the string values like dbPath value in quotes.

I had an extremely similar error when trying to setup SSL, searching for my problem this was the only relevant result, but was not the solution that was required.

I had a problem with the error:

"Unrecognized option: net.ssl.mode"

The issue was the mongodb version. I had installed using brew which does not default to mongodb with ssl support. To fix this the I had to use the --with-openssl flag.

brew install mongodb --with-openssl

Ensure the configuration file uses ASCII encoding. mongod does not support configuration files with non-ASCII encoding, including UTF-8.

Also make sure your header isn't commented out security not #security

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top