[MongoDB]: what happend to your queries when any shard (complete RS) goes down

We observed when any complete shard (all nodes in that replica set) got down, all the queries which involved data from that down shard are giving failures as below.
Want to know whether it’s expected behavior ?

mongos> db.shrcol.count()
Thu May 14 03:18:08.234 count failed: {
“code” : 11002,
“ok” : 0,
“errmsg” : “exception: socket exception [CONNECT_ERROR] for rs2/12d4-dl585-04:27020,12d4-dl585-04:27021”
} at src/mongo/shell/query.js:180

Why can’t we change this behavior such away,

1) if query involves only data from the down shard – we can show error as below.

mongos> db.shrcol.find({ “user_id” : 1 })
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs2/12d4-dl585-04:27020,12d4-dl585-04:27021”,
“code” : 11002,
“shard” : “rs2”
}
2) but if my query involves data from multiple shard including the down shard – why can’t we show the data from the live shards. As of now it’s failing to show the data as below.

mongos> db.shrcol.find({ “user_id” : { $gte : 4850 , $lte : 4858 }})
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs2/12d4-dl585-04:27020,12d4-dl585-04:27021”,
“code” : 11002,
“shard” : “rs2”
}
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4858 , $lte : 4860 }})
{ “_id” : ObjectId(“553a1271abd490759305348c”), “user_id” : 4858, “iteration#” : 4858, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4858 }
{ “_id” : ObjectId(“553a1271abd490759305348d”), “user_id” : 4859, “iteration#” : 4859, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4859 }
{ “_id” : ObjectId(“553a1271abd490759305348e”), “user_id” : 4860, “iteration#” : 4860, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4860 }
Yes it’s possible and here’s solution :
If a shard is inaccessible or unavailable, queries will return with an error.
However, a client may set the partial query bit ie. http://docs.mongodb.org/manual/reference/method/cursor.addOption/#DBQuery.Option.partial , which will then return results from all available shards, regardless of whether a given shard is unavailable.
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 142268 , $lte : 143853 }}).addOption(DBQuery.Option.partial)
{ “_id” : ObjectId(“553a1290abd4907593074d4e”), “user_id” : 142268, “iteration#” : 142268, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 142268 }
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 142268 , $lte : 143853 }})
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs3/dbversity4:27030,dbversity4:27031”,
“code” : 11002,
“shard” : “rs3”
}
mongos>
mongos>

Detailed illustration :-
[root@dbversity4 bin]# ps -ef | grep mongo
root 1991 1908 0 02:25 pts/0 00:00:00 grep mongo
root 10045 1 0 Apr24 ? 02:21:20 ./mongod –replSet rs3 –dbpath /data/2/data/arbiter3 –logpath /data/2/logs/arbiter3.log –port 27032 –config /etc/mongod.conf
root 10049 1 0 Apr24 ? 02:44:49 ./mongod –shardsvr –replSet rs1 –dbpath /data/2/shard1_2 –logpath /data/2/logs/shard1_2.log –port 27011 –config /etc/mongod.conf
root 10054 1 0 Apr24 ? 02:36:09 ./mongod –shardsvr –replSet rs3 –dbpath /data/2/shard3_2 –logpath /data/2/logs/shard3_2.log –port 27031 –config /etc/mongod.conf
root 10057 1 0 Apr24 ? 02:45:37 ./mongod –configsvr –dbpath /data/2/data/config3 –logpath /data/2/logs/config3.log –port 39002 –config /etc/mongod.conf
root 10070 1 0 Apr24 ? 02:20:10 ./mongod –replSet rs2 –dbpath /data/2/data/arbiter2 –logpath /data/2/logs/arbiter2.log –port 27022 –config /etc/mongod.conf
root 10071 1 0 Apr24 ? 03:15:45 ./mongod –shardsvr –replSet rs3 –dbpath /data/2/shard3_1 –logpath /data/2/logs/shard3_1.log –port 27030 –config /etc/mongod.conf
root 10076 1 0 Apr24 ? 02:49:06 ./mongod –configsvr –dbpath /data/2/data/config2 –logpath /data/2/logs/config2.log –port 39001 –config /etc/mongod.conf
root 10077 1 0 Apr24 ? 03:08:04 ./mongod –shardsvr –replSet rs1 –dbpath /data/2/shard1_1 –logpath /data/2/logs/shard1_1.log –port 27010 –config /etc/mongod.conf
root 10078 1 0 Apr24 ? 03:05:58 ./mongod –configsvr –dbpath /data/2/data/config1 –logpath /data/2/logs/config1.log –port 39000 –config /etc/mongod.conf
root 10082 1 0 Apr24 ? 02:53:21 ./mongod –shardsvr –replSet rs2 –dbpath /data/2/shard2_1 –logpath /data/2/logs/shard2_1.log –port 27020 –config /etc/mongod.conf
root 10083 1 0 Apr24 ? 02:19:52 ./mongod –replSet rs1 –dbpath /data/2/data/arbiter1 –logpath /data/2/logs/arbiter1.log –port 27012 –config /etc/mongod.conf
root 10085 1 0 Apr24 ? 02:27:31 ./mongod –shardsvr –replSet rs2 –dbpath /data/2/shard2_2 –logpath /data/2/logs/shard2_2.log –port 27021 –config /etc/mongod.conf
root 11930 1 0 Apr24 ? 02:21:27 ./mongos –configdb 10.40.87.37:39000,10.40.87.37:39001,10.40.87.37:39002 –logpath /data/2/logs/router.log –port 10000
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo –port 10000
MongoDB shell version: 2.4.11
connecting to: 127.0.0.1:10000/test
mongos>
mongos>
mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“version” : 3,
“minCompatibleVersion” : 3,
“currentVersion” : 4,
“clusterId” : ObjectId(“553a0888a7efcb27971349c4”)
}
shards:
{ “_id” : “rs1”, “host” : “rs1/dbversity4:27010,dbversity4:27011” }
{ “_id” : “rs2”, “host” : “rs2/dbversity4:27020,dbversity4:27021” }
{ “_id” : “rs3”, “host” : “rs3/dbversity4:27030,dbversity4:27031” }
databases:
{ “_id” : “admin”, “partitioned” : false, “primary” : “config” }
{ “_id” : “shrdb”, “partitioned” : true, “primary” : “rs3” }
shrdb.shrcol
shard key: { “user_id” : 1 }
chunks:
rs1 2
rs2 1
rs3 2
{ “user_id” : { “$minKey” : 1 } } –>> { “user_id” : 1 } on : rs1 Timestamp(2, 0)
{ “user_id” : 1 } –>> { “user_id” : 4854 } on : rs2 Timestamp(3, 0)
{ “user_id” : 4854 } –>> { “user_id” : 142269 } on : rs1 Timestamp(4, 0)
{ “user_id” : 142269 } –>> { “user_id” : 298496 } on : rs3 Timestamp(4, 1)
{ “user_id” : 298496 } –>> { “user_id” : { “$maxKey” : 1 } } on : rs3 Timestamp(3, 5)
{ “_id” : “test”, “partitioned” : false, “primary” : “rs3” }

mongos>
mongos>
mongos> show dbs
admin (empty)
config 0.046875GB
shrdb 1.187255859375GB
test (empty)
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> use shrdb
switched to db shrdb
mongos>
mongos>
mongos> show collections
shrcol
system.indexes
mongos>
mongos>
mongos> db.shrcol.find()
{ “_id” : ObjectId(“553a126fabd4907593052193”), “user_id” : 1, “iteration#” : 1, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 1 }
{ “_id” : ObjectId(“553a1290abd490759307537f”), “user_id” : 143853, “iteration#” : 143853, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143853 }
{ “_id” : ObjectId(“553a1271abd4907593053488”), “user_id” : 4854, “iteration#” : 4854, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4854 }
{ “_id” : ObjectId(“553a126fabd4907593052194”), “user_id” : 2, “iteration#” : 2, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 2 }
{ “_id” : ObjectId(“553a1290abd4907593075380”), “user_id” : 143854, “iteration#” : 143854, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143854 }
{ “_id” : ObjectId(“553a1271abd4907593053489”), “user_id” : 4855, “iteration#” : 4855, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4855 }
{ “_id” : ObjectId(“553a126fabd4907593052195”), “user_id” : 3, “iteration#” : 3, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 3 }
{ “_id” : ObjectId(“553a1290abd4907593075381”), “user_id” : 143855, “iteration#” : 143855, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143855 }
{ “_id” : ObjectId(“553a1271abd490759305348a”), “user_id” : 4856, “iteration#” : 4856, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4856 }
{ “_id” : ObjectId(“553a126fabd4907593052196”), “user_id” : 4, “iteration#” : 4, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4 }
{ “_id” : ObjectId(“553a1290abd4907593075382”), “user_id” : 143856, “iteration#” : 143856, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143856 }
{ “_id” : ObjectId(“553a1271abd490759305348b”), “user_id” : 4857, “iteration#” : 4857, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4857 }
{ “_id” : ObjectId(“553a126fabd4907593052197”), “user_id” : 5, “iteration#” : 5, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 5 }
{ “_id” : ObjectId(“553a1290abd4907593075383”), “user_id” : 143857, “iteration#” : 143857, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143857 }
{ “_id” : ObjectId(“553a1271abd490759305348c”), “user_id” : 4858, “iteration#” : 4858, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4858 }
{ “_id” : ObjectId(“553a126fabd4907593052198”), “user_id” : 6, “iteration#” : 6, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 6 }
{ “_id” : ObjectId(“553a1290abd4907593075384”), “user_id” : 143858, “iteration#” : 143858, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143858 }
{ “_id” : ObjectId(“553a1271abd490759305348d”), “user_id” : 4859, “iteration#” : 4859, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4859 }
{ “_id” : ObjectId(“553a126fabd4907593052199”), “user_id” : 7, “iteration#” : 7, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 7 }
{ “_id” : ObjectId(“553a1290abd4907593075385”), “user_id” : 143859, “iteration#” : 143859, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 143859 }
Type “it” for more
mongos>
mongos>
mongos>
mongos> db.shrcol.count()
1000000
mongos>
mongos>
bye
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo dbversity4:27010/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:27010/shrdb
rs1:PRIMARY>
rs1:PRIMARY> db.shrcol.count()
137415
rs1:PRIMARY>
bye
[root@dbversity4 bin]# ./mongo dbversity4:27020/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:27020/shrdb
rs2:PRIMARY>
rs2:PRIMARY> db.shrcol.count()
4853
rs2:PRIMARY>
bye
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo dbversity4:27030/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:27030/shrdb
rs3:PRIMARY>
rs3:PRIMARY> db.shrcol.count()
857732
rs3:PRIMARY>
rs3:PRIMARY>
bye
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo dbversity4:27020/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:27020/shrdb
rs2:PRIMARY>
rs2:PRIMARY> db.shrcol.find()
{ “_id” : ObjectId(“553a126fabd4907593052193”), “user_id” : 1, “iteration#” : 1, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 1 }
{ “_id” : ObjectId(“553a126fabd4907593052194”), “user_id” : 2, “iteration#” : 2, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 2 }
{ “_id” : ObjectId(“553a126fabd4907593052195”), “user_id” : 3, “iteration#” : 3, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 3 }
{ “_id” : ObjectId(“553a126fabd4907593052196”), “user_id” : 4, “iteration#” : 4, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4 }
{ “_id” : ObjectId(“553a126fabd4907593052197”), “user_id” : 5, “iteration#” : 5, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 5 }
{ “_id” : ObjectId(“553a126fabd4907593052198”), “user_id” : 6, “iteration#” : 6, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 6 }
{ “_id” : ObjectId(“553a126fabd4907593052199”), “user_id” : 7, “iteration#” : 7, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 7 }
{ “_id” : ObjectId(“553a126fabd490759305219a”), “user_id” : 8, “iteration#” : 8, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 8 }
{ “_id” : ObjectId(“553a126fabd490759305219b”), “user_id” : 9, “iteration#” : 9, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 9 }
{ “_id” : ObjectId(“553a126fabd490759305219c”), “user_id” : 10, “iteration#” : 10, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 10 }
{ “_id” : ObjectId(“553a126fabd490759305219d”), “user_id” : 11, “iteration#” : 11, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 11 }
{ “_id” : ObjectId(“553a126fabd490759305219e”), “user_id” : 12, “iteration#” : 12, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 12 }
{ “_id” : ObjectId(“553a126fabd490759305219f”), “user_id” : 13, “iteration#” : 13, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 13 }
{ “_id” : ObjectId(“553a126fabd49075930521a0”), “user_id” : 14, “iteration#” : 14, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 14 }
{ “_id” : ObjectId(“553a126fabd49075930521a1”), “user_id” : 15, “iteration#” : 15, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 15 }
{ “_id” : ObjectId(“553a126fabd49075930521a2”), “user_id” : 16, “iteration#” : 16, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 16 }
{ “_id” : ObjectId(“553a126fabd49075930521a3”), “user_id” : 17, “iteration#” : 17, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 17 }
{ “_id” : ObjectId(“553a126fabd49075930521a4”), “user_id” : 18, “iteration#” : 18, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 18 }
{ “_id” : ObjectId(“553a126fabd49075930521a5”), “user_id” : 19, “iteration#” : 19, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 19 }
{ “_id” : ObjectId(“553a126fabd49075930521a6”), “user_id” : 20, “iteration#” : 20, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 20 }
Type “it” for more
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shrcol.find({ “user_id” : { $gte : 1 , $lte : 4853 }}).count()
4853
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shrcol.count()
4853
rs2:PRIMARY>
rs2:PRIMARY>
bye
[root@dbversity4 bin]
[root@dbversity4 bin]# ./mongo dbversity4:10000/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:10000/shrdb
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 1 , $lte : 4853 }}).count()
4853
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 1 , $lte : 4853 }}).explain()
{
“clusteredType” : “ParallelSort”,
“shards” : {
“rs2/dbversity4:27020,dbversity4:27021” : [
{
“cursor” : “BtreeCursor user_id_1”,
“isMultiKey” : false,
“n” : 4853,
“nscannedObjects” : 4853,
“nscanned” : 4853,
“nscannedObjectsAllPlans” : 4853,
“nscannedAllPlans” : 4853,
“scanAndOrder” : false,
“indexOnly” : false,
“nYields” : 0,
“nChunkSkips” : 0,
“millis” : 47,
“indexBounds” : {
“user_id” : [
[
1,
4853
]
]
},
“server” : “dbversity4:27020”
}
]
},
“cursor” : “BtreeCursor user_id_1”,
“n” : 4853,
“nChunkSkips” : 0,
“nYields” : 0,
“nscanned” : 4853,
“nscannedAllPlans” : 4853,
“nscannedObjects” : 4853,
“nscannedObjectsAllPlans” : 4853,
“millisShardTotal” : 47,
“millisShardAvg” : 47,
“numQueries” : 1,
“numShards” : 1,
“indexBounds” : {
“user_id” : [
[
1,
4853
]
]
},
“millis” : 48
}
mongos>
mongos>

Detailed Illustation :-
[root@dbversity4 bin]# ./mongo localhost:27020/shrdb
MongoDB shell version: 2.4.11
connecting to: localhost:27020/shrdb
rs2:PRIMARY>
rs2:PRIMARY> use admin
switched to db admin
rs2:PRIMARY> db.shutdownServer()
Thu May 14 03:06:57.943 DBClientCursor::init call() failed
server should be down…
Thu May 14 03:06:57.948 trying reconnect to localhost:27020
Thu May 14 03:06:57.948 reconnect localhost:27020 failed couldn’t connect to server localhost:27020
>
Thu May 14 03:06:59.042 trying reconnect to localhost:27020
Thu May 14 03:06:59.042 reconnect localhost:27020 failed couldn’t connect to server localhost:27020
>
bye
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo localhost:27021/shrdb
MongoDB shell version: 2.4.11
connecting to: localhost:27021/shrdb
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> use admin
switched to db admin
rs2:PRIMARY>
rs2:PRIMARY>
rs2:PRIMARY> db.shutdownServer()
assert failed : unexpected error: “shutdownServer failed: no secondaries within 10 seconds of my optime”
Error: Printing Stack Trace
at printStackTrace (src/mongo/shell/utils.js:37:15)
at doassert (src/mongo/shell/assert.js:6:5)
at assert (src/mongo/shell/assert.js:14:5)
at DB.shutdownServer (src/mongo/shell/db.js:346:9)
at (shell):1:4
Thu May 14 03:07:16.454 assert failed : unexpected error: “shutdownServer failed: no secondaries within 10 seconds of my optime” at src/mongo/shell/assert.js:7
rs2:PRIMARY>
rs2:PRIMARY>

[root@dbversity4 bin]# ps -ef | grep mongo | grep 27021
root 10085 1 0 Apr24 ? 02:27:44 ./mongod –shardsvr –replSet rs2 –dbpath /data/2/shard2_2 –logpath /data/2/logs/shard2_2.log –port 27021 –config /etc/mongod.conf
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]# kill -9 10085
[root@dbversity4 bin]#
[root@dbversity4 bin]#
[root@dbversity4 bin]# ps -ef | grep mongo
root 10045 1 0 Apr24 ? 02:21:33 ./mongod –replSet rs3 –dbpath /data/2/data/arbiter3 –logpath /data/2/logs/arbiter3.log –port 27032 –config /etc/mongod.conf
root 10049 1 0 Apr24 ? 02:45:03 ./mongod –shardsvr –replSet rs1 –dbpath /data/2/shard1_2 –logpath /data/2/logs/shard1_2.log –port 27011 –config /etc/mongod.conf
root 10054 1 0 Apr24 ? 02:36:22 ./mongod –shardsvr –replSet rs3 –dbpath /data/2/shard3_2 –logpath /data/2/logs/shard3_2.log –port 27031 –config /etc/mongod.conf
root 10057 1 0 Apr24 ? 02:45:52 ./mongod –configsvr –dbpath /data/2/data/config3 –logpath /data/2/logs/config3.log –port 39002 –config /etc/mongod.conf
root 10070 1 0 Apr24 ? 02:20:23 ./mongod –replSet rs2 –dbpath /data/2/data/arbiter2 –logpath /data/2/logs/arbiter2.log –port 27022 –config /etc/mongod.conf
root 10071 1 0 Apr24 ? 03:16:01 ./mongod –shardsvr –replSet rs3 –dbpath /data/2/shard3_1 –logpath /data/2/logs/shard3_1.log –port 27030 –config /etc/mongod.conf
root 10076 1 0 Apr24 ? 02:49:21 ./mongod –configsvr –dbpath /data/2/data/config2 –logpath /data/2/logs/config2.log –port 39001 –config /etc/mongod.conf
root 10077 1 0 Apr24 ? 03:08:21 ./mongod –shardsvr –replSet rs1 –dbpath /data/2/shard1_1 –logpath /data/2/logs/shard1_1.log –port 27010 –config /etc/mongod.conf
root 10078 1 0 Apr24 ? 03:06:15 ./mongod –configsvr –dbpath /data/2/data/config1 –logpath /data/2/logs/config1.log –port 39000 –config /etc/mongod.conf
root 10083 1 0 Apr24 ? 02:20:05 ./mongod –replSet rs1 –dbpath /data/2/data/arbiter1 –logpath /data/2/logs/arbiter1.log –port 27012 –config /etc/mongod.conf
root 11930 1 0 Apr24 ? 02:21:40 ./mongos –configdb 10.40.87.37:39000,10.40.87.37:39001,10.40.87.37:39002 –logpath /data/2/logs/router.log –port 10000
root 15122 1908 0 03:08 pts/0 00:00:00 grep mongo
[root@dbversity4 bin]#
[root@dbversity4 bin]# ./mongo dbversity4:10000/shrdb
MongoDB shell version: 2.4.11
connecting to: dbversity4:10000/shrdb
mongos>
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 1 , $lte : 4853 }}).explain()
Thu May 14 03:09:05.875 error: { “$err” : “ReplicaSetMonitor no master found for set: rs2”, “code” : 10009 } at src/mongo/shell/query.js:128
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 1 , $lte : 4853 }}).count()
Thu May 14 03:09:29.327 count failed: {
“code” : 10009,
“ok” : 0,
“errmsg” : “exception: ReplicaSetMonitor no master found for set: rs2”
} at src/mongo/shell/query.js:180
mongos>
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : 1 })
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs2/dbversity4:27020,dbversity4:27021”,
“code” : 11002,
“shard” : “rs2”
}
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4850 , $lte : 4858 }}).count()
Thu May 14 03:11:24.873 count failed: {
“code” : 11002,
“ok” : 0,
“errmsg” : “exception: socket exception [CONNECT_ERROR] for rs2/dbversity4:27020,dbversity4:27021”
} at src/mongo/shell/query.js:180
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4850 , $lte : 4858 }})
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs2/dbversity4:27020,dbversity4:27021”,
“code” : 11002,
“shard” : “rs2”
}
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4858 , $lte : 4860 }})
{ “_id” : ObjectId(“553a1271abd490759305348c”), “user_id” : 4858, “iteration#” : 4858, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4858 }
{ “_id” : ObjectId(“553a1271abd490759305348d”), “user_id” : 4859, “iteration#” : 4859, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4859 }
{ “_id” : ObjectId(“553a1271abd490759305348e”), “user_id” : 4860, “iteration#” : 4860, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4860 }
mongos>
mongos>
mongos>
mongos>
mongos>
mongos>
mongos> db.shrcol.count()
Thu May 14 03:18:08.234 count failed: {
“code” : 11002,
“ok” : 0,
“errmsg” : “exception: socket exception [CONNECT_ERROR] for rs2/dbversity4:27020,dbversity4:27021”
} at src/mongo/shell/query.js:180
mongos>
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4858 , $lte : 143853 }}).addOption(DBQuery.Option.partial)
{ “_id” : ObjectId(“553a1271abd490759305348c”), “user_id” : 4858, “iteration#” : 4858, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4858 }
{ “_id” : ObjectId(“553a1271abd490759305348d”), “user_id” : 4859, “iteration#” : 4859, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4859 }
{ “_id” : ObjectId(“553a1271abd490759305348e”), “user_id” : 4860, “iteration#” : 4860, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4860 }
{ “_id” : ObjectId(“553a1271abd490759305348f”), “user_id” : 4861, “iteration#” : 4861, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4861 }
{ “_id” : ObjectId(“553a1271abd4907593053490”), “user_id” : 4862, “iteration#” : 4862, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4862 }
{ “_id” : ObjectId(“553a1271abd4907593053491”), “user_id” : 4863, “iteration#” : 4863, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4863 }
{ “_id” : ObjectId(“553a1271abd4907593053492”), “user_id” : 4864, “iteration#” : 4864, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4864 }
{ “_id” : ObjectId(“553a1271abd4907593053493”), “user_id” : 4865, “iteration#” : 4865, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4865 }
{ “_id” : ObjectId(“553a1271abd4907593053494”), “user_id” : 4866, “iteration#” : 4866, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4866 }
{ “_id” : ObjectId(“553a1271abd4907593053495”), “user_id” : 4867, “iteration#” : 4867, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4867 }
{ “_id” : ObjectId(“553a1271abd4907593053496”), “user_id” : 4868, “iteration#” : 4868, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4868 }
{ “_id” : ObjectId(“553a1271abd4907593053497”), “user_id” : 4869, “iteration#” : 4869, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4869 }
{ “_id” : ObjectId(“553a1271abd4907593053498”), “user_id” : 4870, “iteration#” : 4870, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4870 }
{ “_id” : ObjectId(“553a1271abd4907593053499”), “user_id” : 4871, “iteration#” : 4871, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4871 }
{ “_id” : ObjectId(“553a1271abd490759305349a”), “user_id” : 4872, “iteration#” : 4872, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4872 }
{ “_id” : ObjectId(“553a1271abd490759305349b”), “user_id” : 4873, “iteration#” : 4873, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4873 }
{ “_id” : ObjectId(“553a1271abd490759305349c”), “user_id” : 4874, “iteration#” : 4874, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4874 }
{ “_id” : ObjectId(“553a1271abd490759305349d”), “user_id” : 4875, “iteration#” : 4875, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4875 }
{ “_id” : ObjectId(“553a1271abd490759305349e”), “user_id” : 4876, “iteration#” : 4876, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4876 }
{ “_id” : ObjectId(“553a1271abd490759305349f”), “user_id” : 4877, “iteration#” : 4877, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 4877 }
Type “it” for more
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 4858 , $lte : 143853 }})
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs3/dbversity4:27030,dbversity4:27031”,
“code” : 11002,
“shard” : “rs3”
}
mongos>
mongos>
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 142268 , $lte : 143853 }}).addOption(DBQuery.Option.partial)
{ “_id” : ObjectId(“553a1290abd4907593074d4e”), “user_id” : 142268, “iteration#” : 142268, “company” : “dbversity”, “data” : “dummy data”, “occurance” : 142268 }
mongos>
mongos>
mongos> db.shrcol.find({ “user_id” : { $gte : 142268 , $lte : 143853 }})
error: {
“$err” : “socket exception [CONNECT_ERROR] for rs3/dbversity4:27030,dbversity4:27031”,
“code” : 11002,
“shard” : “rs3”
}
mongos>
mongos>

  • Ask Question