Re: Re: balancing databases within a cluster

From: Yann Simon <yann.simon.fr@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Apr 2016 14:39:58 +0000
Why ads?
Thanks for this great answer!

Sharding may not be what we need for our current needs. (We may need that
in the future though for huge collections.)

Regards,
Yann

Le mar. 26 avr. 2016 à 14:34, William Byrne III <william.byrne@xxxxxxxxxxx>
a écrit :

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
<https://groups.google.com/d/msgid/mongodb-user/c364ec07-4e22-4648-b8ac-2493a8b6a4dd%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.


-- 
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/CAFfBxfFPUykeWWxR1BP5NHvnt8K%3DfCynckQX2vS_FD47pAzayg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?