Re: balancing databases within a cluster

From: William Byrne III <william.byrne@xxxxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Apr 2016 16:50:30 -0700 (PDT)
Why ads?


Yann,

When you create a database (by creating the first collection in it) in a sharded 
cluster <https://docs.mongodb.org/manual/core/sharding-introduction/>, the 
mongos <https://docs.mongodb.org/manual/reference/program/mongos/> will set 
a primary shard 
<https://docs.mongodb.org/manual/core/sharded-cluster-shards/#primary-shard
for the database. This is where all un-sharded collections for that 
database will be stored. As you don’t plan to shard any of your 
collections, all collections for each database will be stored on its 
primary shard.

You can see databases and their primary shards in the output of sh.status() 
<https://docs.mongodb.org/manual/reference/method/sh.status/>, or by 
displaying the contents of the config.databases collection:

use config;
db.databases.find()

Primary shards are chosen for new databases on the basis of which shard has 
the most free space at the time the database is created. You can change the 
primary chunk of a database with the movePrimary 
<https://docs.mongodb.org/manual/reference/command/movePrimary/> command:

db.adminCommand({movePrimary:"salesDB", to:"shard0003"});

Tag aware sharding 
<https://docs.mongodb.org/manual/core/tag-aware-sharding/> can only be used 
to control the location of ranges of documents within sharded collections, 
so using tags to migrate databases will not be an option until you fully 
implement sharding. 

Regards,

III
------------------------------




-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/c364ec07-4e22-4648-b8ac-2493a8b6a4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?