0

分片状态:

mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“minCompatibleVersion” : 5,
“currentVersion” : 6,
“clusterId” : ObjectId(“61f1047dbc922cff53eed032”)
}
shards:
{ “_id” : “shard1”, “host” : “shard1/10.172.69.1:27001,10.172.69.2:27001,10.172.69.3:27001”, “state” : 1, “topologyTime” : Timestamp(1644223426, 3) }
{ “_id” : “shard2”, “host” : “shard2/10.172.69.1:27002,10.172.69.2:27002,10.172.69.3:27002”, “state” : 1, “topologyTime” : Timestamp(1644223442, 2) }
{ “_id” : “shard3”, “host” : “shard3/10.172.69.1:27003,10.172.69.2:27003,10.172.69.3:27003”, “state” : 1, “topologyTime” : Timestamp(1648091689, 1) }
active mongoses:
“5.0.5” : 3
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration results for the last 24 hours:
No recent migrations
databases:
{ “_id” : “calon”, “primary” : “shard2”, “partitioned” : true, “version” : { “uuid” : UUID(“da5bd5c7-aa60-467e-9048-8eb0ee4392fc”), “timestamp” : Timestamp(1644223986, 34), “lastMod” : 1 } }
{ “_id” : “config”, “primary” : “config”, “partitioned” : true }
config.system.sessions
shard key: { “_id” : 1 }
unique: false
balancing: true
chunks:
shard1 511
shard2 512
shard3 1
too many chunks to print, use verbose if you want to force print
{ “_id” : “ning”, “primary” : “shard2”, “partitioned” : false, “version” : { “uuid” : UUID(“99730e55-19bd-444d-9005-6d0990d44d9c”), “timestamp” : Timestamp(1648781810, 1), “lastMod” : 1 } }
{ “_id” : “product”, “primary” : “shard2”, “partitioned” : true, “version” : { “uuid” : UUID(“65db6c87-6e45-4cb5-94db-b052887b2dd8”), “timestamp” : Timestamp(1648106610, 2), “lastMod” : 1 } }
{ “_id” : “shard1”, “primary” : “shard2”, “partitioned” : false, “version” : { “uuid” : UUID(“d8b11909-66ab-4dee-8d83-0953f2efc6c3”), “timestamp” : Timestamp(1648521858, 1), “lastMod” : 1 } }
{ “_id” : “test”, “primary” : “shard1”, “partitioned” : false, “version” : { “uuid” : UUID(“fdb47d5a-4219-4022-ad4f-db20ed1389db”), “timestamp” : Timestamp(1646189218, 1), “lastMod” : 1 } }

老表正常:

mongos> use config
switched to db config
mongos> show tables
actionlog
changelog
chunks
collections
databases
image_collection
lockpings
locks
migrations
mongos
reshardingOperations
setting
settings
shards
system.indexBuilds
system.profile
tags
transactions
version
mongos> use admin
switched to db admin
mongos> show tables
system.keys
system.users
system.version
mongos> use test
switched to db test
mongos> show tables
redis_storage
system.profile

新表报错:

mongos> use product
switched to db product
mongos> show tables
uncaught exception: Error: listCollections failed: {
“ok” : 0,
“errmsg” : “Cannot accept sharding commands if sharding state has not been initialized with a shardIdentity document”,
“code” : 203,
“codeName” : “ShardingStateNotInitialized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1648782817, 5),
“signature” : {
“hash” : BinData(0,”AAAAAAAAAAAAAAAAAAAAAAAAAAA=”),
“keyId” : NumberLong(0)
}
},
“operationTime” : Timestamp(1648782809, 1)
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:718:15
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:766:16
shellHelper.show@src/mongo/shell/utils.js:943:9
shellHelper@src/mongo/shell/utils.js:838:15
@(shellhelp2):1:1

已回答的问题