mongos can't get collection

44 views
Skip to first unread message

xiang

unread,
Dec 7, 2016, 12:02:15 AM12/7/16
to mongodb-user
there is a collection can be find by replica set, but can't be found by mongos on server A, can be found by mongos on server B. why ? and how to solve  it ?


repl3:SECONDARY> rs.slaveOk()
repl3:SECONDARY> use G4
switched to db G4
repl3:SECONDARY> db.Account.count()
66007437

mongos> use G4
switched to db G4
mongos> db.Account.count()
0

Rhys Campbell

unread,
Dec 7, 2016, 3:48:52 AM12/7/16
to mongodb-user
Presumably this is a sharded cluster?

What's the output of...

mongos> sh.status();


Kevin Adistambha

unread,
Dec 18, 2016, 11:08:17 PM12/18/16
to mongodb-user

Hi,

there is a collection can be find by replica set, but can’t be found by mongos on server A, can be found by mongos on server B

I’m a bit unclear on the exact issue you’re having. Could you post more details:

  • Your MongoDB and your O/S version
  • Your deployment topology (how many shards, how many nodes in a replica set, etc.)
  • Output of sh.status() as suggested by Rhys

You mention that the collection exist in some shards, but cannot be found using mongos. Is the collection supposed to exist, or not?

If your deployment is a sharded cluster, have this collection been dropped in the past? If the collection exists in some shard but not in other, the drop may be unsuccessful in some shards (typically caused by network issues during the drop). You would need to go into each shard and perform the db.Account.drop() command to ensure that the collection was dropped from all shards.

Please note that after dropping a collection in a sharded cluster, it is recommended to restart all your mongos processes to ensure that no mongos still caches the dropped collection.

Best regards,
Kevin

xiang

unread,
Dec 19, 2016, 5:54:25 AM12/19/16
to mongodb-user


在 2016年12月7日星期三 UTC+8下午4:48:52,Rhys Campbell写道:
Presumably this is a sharded cluster?

What's the output of...

mongos> sh.status();

run sh.status() don't show  this database

xiang

unread,
Dec 19, 2016, 5:56:14 AM12/19/16
to mongodb-user
ok, thanks for your reply. I will try

在 2016年12月19日星期一 UTC+8下午12:08:17,Kevin Adistambha写道:
Reply all
Reply to author
Forward
0 new messages