![](/img/trans.png)
[英]MongoDB YAML "Unrecognized option: security.ldap.servers"
[英]MongoDB YAML “Unrecognized option: security”
我在Windows Server 2012上运行Mongo DB版本2.6。我在设置YAML配置文件以获取安全性和授权时遇到问题。 当我具有以下配置文件时,我只会收到一条错误消息,提示“无法识别的选项:安全性”。 我的配置有什么问题?
mongod_test.conf:
security:
authorization: enabled
authenticationMechanisms: MONGODB-CR
storage:
dbPath: F:\MongoData
命令行:
mongod.exe --config mongod_test.conf
我在文件中添加了空格,这解决了部分问题。 从上面更新的配置,我得到的当前错误是:
c:\MongoDBFolder\bin>mongod.exe --config mongod_test.conf
Unrecognized option: security.authenticationMechanisms
try 'mongod.exe --help' for more information
无法说出您的确切配置,但是Yaml需要冒号+空格来分隔键和值,否则会出现解析错误;
security:
authorization: enabled
authenticationMechanisms: MONGODB-CR
storage:
dbPath: F:\MongoData
错误:
Unrecognized option: security.authenticationMechanisms
这是因为authenticationMechanisms不属于“安全性”配置。
根据文档: http : //docs.mongodb.org/manual/reference/configuration-options/#security
但是,根据此文档,authenticationMechanisms是“ setParameter”的一个选项:
http://docs.mongodb.org/manual/reference/parameters/#param.authentication机制
我发现文档令人费解并且令人困惑,但是我还没有发现任何与此矛盾的东西。
因此,鉴于以上所述,我认为您应该查看以下内容:
security:
authorization: enabled
setParameter:
authenticationMechanisms: MONGODB-CR
storage:
dbPath: "F:\MongoData"
您可以确保键值对行的“:”后面有空格,并且还可以将字符串值(例如dbPath值)用引号引起来。
确保配置文件使用ASCII编码。 mongod不支持使用非ASCII编码的配置文件,包括UTF-8。
尝试设置SSL时,我遇到一个极其相似的错误,搜索我的问题,这是唯一相关的结果,但不是所需的解决方案。
我的错误出现了问题:
“无法识别的选项:net.ssl.mode”
问题是mongodb版本。 我使用的是brew安装,默认情况下不支持ssl的mongodb。 为了解决这个问题,我不得不使用--with-openssl
标志。
brew install mongodb --with-openssl
还要确保您的标头没有被注释掉security
不是#security
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.