I have a sharded cluster with 4 shards, 3 config databases. My problem is when I do my inserts only one shard gets filled. Can anyone please explain to me why this is happening. My first thought was that it has something to do with the shard-key but i tried a few and nothing changed.
mongos> db.flight.stats()
{
"sharded" : true,
"systemFlags" : 1,
"userFlags" : 1,
"ns" : "flights.flight",
"count" : 2874004,
"numExtents" : 17,
"size" : 689760960,
"storageSize" : 857440256,
"totalIndexSize" : 211537648,
"indexSizes" : {
"_id_" : 93255456,
"departureAirport_1" : 118282192
},
"avgObjSize" : 240,
"nindexes" : 2,
"nchunks" : 20,
"shards" : {
"shard0002" : {
"ns" : "flights.flight",
"count" : 2874004,
"size" : 689760960,
"avgObjSize" : 240,
"storageSize" : 857440256,
"numExtents" : 17,
"nindexes" : 2,
"lastExtentSize" : 227803136,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 1,
"totalIndexSize" : 211537648,
"indexSizes" : {
"_id_" : 93255456,
"departureAirport_1" : 118282192
},
"ok" : 1
}
},
"ok" : 1
}
Sharding status information:
mongos> sh.status()
sharding version: {
"_id" : 1,
"version" : 4,
"minCompatibleVersion" : 4,
"currentVersion" : 5,
"clusterId" : ObjectId("538c20fdbf2687fbbc582642")
}
shards:
{ "_id" : "shard0000", "host" : "cs-mongo-shard-1-east-t:10001" }
{ "_id" : "shard0001", "host" : "cs-mongo-shard-2-east-t:10001" }
{ "_id" : "shard0002", "host" : "10.1.10.15:10001" }
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "flights", "partitioned" : true, "primary" : "shard0002" }
flights.flight
shard key: {
"departureAirport" : 1,
"arrivalAirport" : 1,
"departureDate" : 1,
"availability" : 1
}
chunks:
shard0002 1
{
"departureAirport" : { "$minKey" : 1 },
"arrivalAirport" : { "$minKey" : 1 },
"departureDate" : { "$minKey" : 1 },
"availability" : { "$minKey" : 1 }
} -->> {
"departureAirport" : { "$maxKey" : 1 },
"arrivalAirport" : { "$maxKey" : 1 },
"departureDate" : { "$maxKey" : 1 },
"availability" : { "$maxKey" : 1 }
} on : shard0002 Timestamp(1, 0)