A probably dumb question about sharding

33 views
Skip to first unread message

s.molinari

unread,
Jul 9, 2014, 1:41:32 AM7/9/14
to mongod...@googlegroups.com
If we have multiple databases on a replica set and decide we need to shard only one collection from only one database, would the whole system become a sharded cluster and need running mongos'es for all queries, even the for unsharded collections after that?

Scott

s.molinari

unread,
Jul 9, 2014, 1:56:25 AM7/9/14
to mongod...@googlegroups.com
Off topic. I hate Google Groups, because I can't edit my posts. Another try.

If we have multiple databases on a replica set and decide we need to shard only one collection from only one database, would the whole system become a sharded cluster and need running mongos'es for all queries, even queries on unsharded collections after that?

Scott

Asya Kamsky

unread,
Jul 9, 2014, 5:00:07 AM7/9/14
to mongodb-user
If you shard one collection from only one database, then you no longer have only one replica set...  you presumably then have several (as many as there are shards).

So, yes, you should then route all of your operations through mongos(s).  Technically, the results will be the same for unsharded collections and databases whether you query though mongos or directly against the replica set/shard ...  but of course you would have to know which shard to query against, and that's the whole point of mongos and sharding - you don't need to know where things live.

Asya



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/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...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/aae31000-d8e9-4568-b146-9d113101f5fb%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

s.molinari

unread,
Jul 9, 2014, 12:13:45 PM7/9/14
to mongod...@googlegroups.com
Thanks Asya. I was thinking that would be the answer, but wasn't sure. I thought there might be a way to programmatically avoid routing queries through Mongos. I guess though, if there is no overhead routing queries for non-sharded collections through Mongos, then it doesn't matter really.

Scott  
Reply all
Reply to author
Forward
0 new messages