我创建了一个 MongoDB 分片集群,其中副本集为 rsa、rsb 和 rsc。配置服务器副本集为 configRS。最初,分片状态仅列出这些分片作为分片数据库的主分片。但现在我可以看到列出了另一个分片“config”。这个分片来自哪里?这是什么意思?
[root@akscentnewtest 1]# mongo --port 27777 --host 172.16.66.74 -u cv_user -p'xxxxx' --authenticationDatabase 'admin' --eval "db.adminCommand( { listDatabases: 1 } )"
MongoDB shell version v3.6.6
connecting to: mongodb://172.16.66.74:27777/
MongoDB server version: 3.6.6
{
"databases" : [
{
"name" : "admin",
"sizeOnDisk" : 147456,
"empty" : false,
"shards" : {
"config" : 147456
}
},
{
"name" : "config",
"sizeOnDisk" : 1228800,
"empty" : false,
"shards" : {
"rsa" : 200704,
"rsb" : 102400,
"rsc" : 118784,
"config" : 806912
}
},
{
"name" : "test",
"sizeOnDisk" : 32768,
"empty" : false,
"shards" : {
"rsb" : 32768
}
}
],
"totalSize" : 1409024,
"totalSizeMb" : 1,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1565775023, 1),
"signature" : {
"hash" : BinData(0,"vIxGUfXD3ZzE5gkr5wSHDBwJuSg="),
"keyId" : NumberLong("6721659792886071315")
}
},
"operationTime" : Timestamp(1565775023, 1)
}
分片状态
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5d4821f8ffb408d9b4ea389a")
}
shards:
{ "_id" : "rsa", "host" : "rsa/172.16.63.8:27000", "state" : 1 }
{ "_id" : "rsb", "host" : "rsb/172.16.66.74:27000", "state" : 1 }
{ "_id" : "rsc", "host" : "rsc/172.16.73.51:27001", "state" : 1 }
active mongoses:
"3.6.6" : 1
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: yes
Failed balancer rounds in last 5 attempts: 5
Last reported error: Could not find host matching read preference { mode: "primary" } for set rsa
Time of Reported error: Wed Aug 14 2019 15:14:01 GMT+0530 (IST)
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "config", "primary" : "config", "partitioned" : true }
config.system.sessions
shard key: { "_id" : 1 }
unique: false
balancing: true
chunks:
rsa 1
{ "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : rsa Timestamp(1, 0)
{ "_id" : "test", "primary" : "rsb", "partitioned" : false }