我在Windows Server 2012上运行Mongo DB版本2.6.我在设置YAML配置文件时遇到安全和授权问题.当我有下面的配置文件时,我只收到一条错误,上面写着"无法识别的选项:安全性".我的配置有什么问题?
mongod_test.conf:
security:
authorization: enabled
authenticationMechanisms: MONGODB-CR
storage:
dbPath: F:\MongoData
Run Code Online (Sandbox Code Playgroud)
命令行:
mongod.exe --config mongod_test.conf
Run Code Online (Sandbox Code Playgroud)
我已经在我的文件中添加了空格,并修复了部分问题.使用上面的更新配置,我得到的当前错误是:
c:\MongoDBFolder\bin>mongod.exe --config mongod_test.conf
Unrecognized option: security.authenticationMechanisms
try 'mongod.exe --help' for more information
Run Code Online (Sandbox Code Playgroud)
Joa*_*son 16
不能说出你的确切配置,但Yaml需要冒号+空格来分隔键和值,否则你会得到解析错误;
security:
authorization: enabled
authenticationMechanisms: MONGODB-CR
storage:
dbPath: F:\MongoData
Run Code Online (Sandbox Code Playgroud)