Why does only 1 shard get created?

Hello there,
In the “chunks” video, I can not figure out why when I mongoimport more data into my mongos instance that my result looks so different from the video.
One difference is that the number of chunks in the databases in the video is different: the video looks like it shows 2 chunk shard IDs and I only get 1. The video shows m103-shard1 and m103-shard2, with chunks split across these 2 items. I, on the other hand, only have one shard with all chunks in it.

I’ve been following the course.
3 data-centric mongod instances in a replica set with clusterRole: shardsvr.
3 config servers with clusterRole configsvr.
1 mongos instance.
I made 1 db called warehouse, with collection called products. I imported 2 products json files.

My sh.status databases output is…

--- Sharding Status --- 
        {  "_id" : "config",  "primary" : "config",  "partitioned" : true }
                        shard key: { "_id" : 1 }
                        unique: false
                        balancing: true
                                m103-example	1
                        { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : m103-example Timestamp(1, 0) 
        {  "_id" : "test",  "primary" : "m103-example",  "partitioned" : false,  "version" : {  "uuid" : UUID("1f33a826-fe33-4014-bd5d-38f2569edae5"),  "lastMod" : 1 } }
        {  "_id" : "warehouse",  "primary" : "m103-example",  "partitioned" : true,  "version" : {  "uuid" : UUID("d0e80910-256f-4662-ac03-b5fa0a36ef6a"),  "lastMod" : 1 } }
                        shard key: { "sku" : 1 }
                        unique: false
                        balancing: true
                                m103-example	59
                        too many chunks to print, use verbose if you want to force print

Please show full output of sh.status() with verbose on
I don’t see shards info in your output

Hello again, I think i figured out why the course and my dbs are different, can someone confirm?

It looks like the video on “chunks” refers to a db setup that includes multiple shards. Up until this point in the course, though, I’ve only setup 1 replica set as a sharded cluster, so I only have 1 shard.

In order to replicate similar output as the videos, I will need to setup more than 1 sharded cluster.
Is that correct?

Yes add second shard

It must have been mentioned in your lab steps

1 Like