Gridfs sharding

22 views
Skip to first unread message

Kyle Wolfe

unread,
Oct 4, 2013, 3:46:57 PM10/4/13
to mongod...@googlegroups.com
I'm at a loss on what exactly is gong on with the gridfs sharding. I read here: http://docs.mongodb.org/manual/tutorial/shard-gridfs-data/


Important

{ files_id : 1 , n : 1 } and {  files_id : 1 } are the only supported shard keys for the chunks collection of a GridFS store.

Am I not able to shard gridfs by something I've placed in the metadata during insert? Id like to shard based on a username that was inserted along with the file (so a users files are on the same node).

Asya Kamsky

unread,
Oct 5, 2013, 3:21:17 AM10/5/13
to mongodb-user
The metadata is not in the chunks collection - it is in the files collection.

There are no other fields in the chunks collection - chunks are just
parts of the file - the descriptive stuff is in files. If you want to
maximize the chance that user's files are on as few shards as
possible, you might consider using the user ID or username as a prefix
for the files _id field (as this will be the files_id value in chunks
collection).

Asya
> --
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
>
> ---
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages