我的 MongoDB shell 版本为 v3.6.5(与旧版本相同)& MongoDB 服务器版本为:3.6.8
我有 MongoDB M0 免费层集群,我想从 shell 使用不同的命令。
到目前为止,一切都很好,但是当我开始使用命令时,我总是遇到问题:
我从这里检查了答案,并尝试使用命令直接从 mongodb shell 创建管理员用户,但也出现了同样的错误:
为什么会发生?如果我已经创建了管理员用户?谁能解释一下,提前非常感谢。
我的配置文件是:
systemLog:
destination: file
logAppend: true
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
journal:
enabled: true
replication:
replSetName: "rs0"
net:
bindIp: 127.0.0.1
port: 27017
security:
authorization: enabled
并得到一个错误:
2018-07-07T15:40:25.092+0300 E QUERY [thread1] Error: error: {
"operationTime" : Timestamp(0, 0),
"ok" : 0,
"errmsg" : "node is not in primary or recovering state",
"code" : 13436,
"codeName" : "NotMasterOrSecondary",
"$clusterTime" : {
"clusterTime" : Timestamp(0, 0),
"signature" : {
"hash" : BinData(0,"FshG5mLBvAQUizPHXGfCITV4ZKA="),
"keyId" : NumberLong("6573732769795407873")
}
}
}
操作系统 Windows 10 x64。MongoDB 3.6.5 版本
当我开始mongo
流程时,我总是得到:
MongoDB shell version v3.6.5 connecting to: mongodb://127.0.0.1:27017/
MongoDB server version: 3.6.5 Server has startup warnings: 2018-07-02T20:56:09.470+0300 I CONTROL [initandlisten] 2018-07-02T20:56:09.470+0300 I CONTROL [initandlisten] ** WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor performance. 2018-07-02T20:56:09.470+0300 I CONTROL [initandlisten] See http://dochub.mongodb.org/core/wt-windows-system file-cache 2018-07-02T20:56:09.470+0300 I CONTROL [initandlisten]
可能,同样的问题在这里,但没有正常的解决方案。我想我需要在配置文件中添加一些东西,例如 - https://docs.mongodb.com/manual/reference/configuration-options/#storage-inmemory-options。
现在我有配置:
systemLog:
destination: file
logAppend: true
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
journal:
enabled: true
replication:
replSetName: "rs0"
net:
bindIp: 127.0.0.1
port: 27017
security:
authorization: enabled
如果我要添加片段:
inMemory:
engineConfig:
inMemorySizeGB: 10
整个配置看起来像:
systemLog:
destination: file
logAppend: true
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
inMemory:
engineConfig:
inMemorySizeGB: 10
journal:
enabled: true
replication:
replSetName: "rs0"
net:
bindIp: 127.0.0.1
port: 27017
security:
authorization: enabled
然后得到错误Unrecognized option: storage.inMemory.engineConfig.inMemorySizeGB
PS我没有使用标签。
任何想法如何避免警告?谢谢。
在配置文件中我有:
systemLog:
destination: file
logAppend: true
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
journal:
enabled: true
replication:
replSetName: "rs0"
net:
bindIp: 127.0.0.1
port: 27017
security:
authorization: enabled
我正在尝试使用文档mongod
中的流程进行连接:
C:\Program Files\MongoDB\Server\3.6\bin> mongod --auth --dbpath /data/db --config C:\Program Files\MongoDB\Server\3.6\mongod.cfg
并获得:
读取配置文件时出错:没有这样的文件或目录
尝试“C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe --help”以获取更多信息
然后尝试引号
C:\Program Files\MongoDB\Server\3.6\bin> mongod --auth --dbpath /data/db --config "C:\Program Files\MongoDB\Server\3.6\mongod.cfg"
并获得:
2018-07-02T02:49:21.272+0300 I CONTROL [main] 日志文件“c:\data\log\mongod.log”存在;移动到“c:\data\log\mongod.log.2018-07-01T23-49-21”。
如果我正在写这个片段(没有配置),一切都很好:
mongod --auth --dbpath /data/db --bind_ip 127.0.0.1