MongoDb Sharding between replica and standalone server

mongodbsharding

So i got a replica set with three servers and a standalone server .
I have enabled sharding between them.

I inserted more data on replica primary server using "rockmongo".

But the chunks are not divided yet and they are still on my replica server

I got more than 50k records so my size in db folder is more than 65M.
the output of sh.status() is

        --- Sharding Status --- 
sharding version: {
"_id" : 1,
"version" : 3,
"minCompatibleVersion" : 3,
"currentVersion" : 4,
"clusterId" : ObjectId("534ab99817bb6815bff6bd47")
}
 shards:
{  "_id" : "rsName",  "host" : "rsName/dhruvil-Inspiron-3521:22017,dhruvil-Inspiron-3521:25017,dhruvil-Inspiron-3521:27001" }
{  "_id" : "shard0000",  "host" : "dhruvil-Inspiron-3521:27917" }
databases:
{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
{  "_id" : "zips",  "partitioned" : true,  "primary" : "rsName" }
    zips.zip
        shard key: { "state" : 1 }
        chunks:
            rsName  1
        { "state" : { "$minKey" : 1 } } -->> { "state" : { "$maxKey" : 1 } } on : rsName Timestamp(1, 0) 

Any thoughts about what i am doing wrong???

Do we insert data on sharded servers in some other way than normal?

Best Answer

Inserts need to be done via the mongos for splits to happen automatically. In fact, all work should be done via the mongos, not directly to the primary on one of the sets. That is why you have not seen any splits happen and your chunks are all still in one place. In terms of details, I've written up some of the details about how splits happen in a previous answer.

Note that you can split manually via the mongos if you want to, you do not have to wait for the automatic splitting to happen.