Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
In Add Shards to the Cluster section, it says: “To actually add the shards to the cluster, we will need to go through the query routers, which are now configured to act as our interface with the cluster. We can do this by connecting to any of the query routers like this:”
mongo --host config0.example.com --port 27017
But shouldn’t we be using query0.example.com or query1.example.com as the host parameter? Pl confirm. Thanks.
Awesome Tutorial, have this up and running perfectly, Just wondering why I have 2 query routers? While connecting to the DB via PHP, do I just connect to the first Query Server or do I have to structure my PHP Code to chose a query server? I.E. When querying pictures I connect to Query Router 2 and when I’m querying products I connect to Query Router 1
@web.dept: You can use one query router instead of two, however, once your application requires more than that and one query router can’t handle it, you can add more query routers to handle the excess load.
Awesome Tutorial.Worked Fine.How could we configure fail over on a mongos (Query Routers).
It is very helpful those are new in the field of mongodb. Just want to know, in which machine(config server, query router, shard server) create, update , delete & find query would be fire, and how? Please provide the input to it.
Thanks a lot in advance.
Great article! Is there a way to ensure that related data is stored on the same shard? For example if you have another collection that points to the test_collection:
{
_id: Object('123'),
test_collection: ObjectId('abc...')
}
My thinking is that all of a user’s data would be on the same shard. Or is that unnecessary optimization?
Thanks!
Nice Article. I’ve written a auto-shard creation script & you can find at http://dbversity.com/mongodb-shard-creation-script/
Hi Mariusc23, you can use tag aware sharding for your requirement btw. More details at http://dbversity.com/tag-aware/
Thanks, DBversity
Some errors still exist in sharding section of this tutorial:
“you can access it again using the same mongo command you used in the last section: mongo --host config0.example.com --port 27017”
There i think you should not connect to config0.example.com but to query0.example.com. End client never should talk to config or shard server, but only to query servers.
Also i don’t see part where it is explained how to start mongo instances on each shard. And that must be done before calling:
sh.addShard( “shard1.example.com:27017” ) sh.addShard( “shard2.example.com:27017” ) sh.addShard( “shard3.example.com:27017” )
So before adding shards i did following on each shard: mongod --shardsvr
( you can also add --storageEngine wiredTiger , if you want to try new storage engine)
Thanks for this great tutorial, exactly what i needed. I hope that my suggestions will help to those who was unable to make it working.
You can refer to http://dbversity.com/mongodb-shard-creation-script/ for the details script & instructions for shard setup