inv*_*bl3 5 mongodb mongodb-3.6
我的配置文件是:
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
Run Code Online (Sandbox Code Playgroud)
并得到一个错误:
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")
}
}
}
Run Code Online (Sandbox Code Playgroud)
Ste*_*nie 10
您已将此节点配置为副本集成员:
replication:
replSetName: "rs0"
Run Code Online (Sandbox Code Playgroud)
启动时,新的 MongoDB 服务器还没有副本集配置。服务器将处于未知副本集成员状态,
直到您将此成员添加到现有副本集配置或用于rs.initiate()
将其建立为新副本集的第一个成员。
您可以使用 确认当前状态rs.status()
。没有任何配置的服务器将在 MongoDB 4.0 中报告类似于以下内容(确切的输出可能因服务器版本而异):
> rs.status()
{
"operationTime" : Timestamp(0, 0),
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized",
"$clusterTime" : {
"clusterTime" : Timestamp(0, 0),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
Run Code Online (Sandbox Code Playgroud)
添加到副本集后,您可以使用rs.status()
和rs.conf()
分别检查当前副本集状态和配置。
归档时间: |
|
查看次数: |
14156 次 |
最近记录: |