发布于 2015-09-14 15:00:57 | 211 次阅读 | 评论: 0 | 来源: 网络整理

shardCollection

The shardCollection command marks a collection for sharding and will allow data to begin distributing among shards. You must run enableSharding on a database before running the shardCollection command.

{ shardCollection: "<db>.<collection>", key: <shardkey> }

This enables sharding for the collection specified by <collection> in the database named <db>, using the key <shardkey> to distribute documents among the shard. <shardkey> is a document, and takes the same form as an index specification document.

Choosing the right shard key to effectively distribute load among your shards requires some planning.

也可以参考

分片 for more information related to sharding. Also consider the section on Shard Key Selection for documentation regarding shard keys.

警告

There’s no easy way to disable sharding after running shardCollection. In addition, you cannot change shard keys once set. If you must convert a sharded cluster to a standalone node or replica set, you must make a single backup of the entire cluster and then restore the backup to the standalone mongod or the replica set..

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务