After you specify a range of values for a shard zone, you can update the shard zone range if your application's requirements change.为分片区域指定一个值范围后,如果应用程序的要求发生变化,您可以更新分片区域范围。
To update an existing shard zone, perform these steps:要更新现有的分片区域,请执行以下步骤:
Stop the balancer.停止平衡器。Remove the old range from the zone.从区域中删除旧范围。Update the zone's range.更新区域的范围。Restart the balancer.重新启动平衡器。
About this Task关于此任务
Zone ranges are inclusive of the lower boundary and exclusive of the upper boundary.区域范围包括下边界,不包括上边界。After you modify a zone, the balancer must migrate chunks to the appropriate zones based on the new range of values. Until balancing completes, some chunks may reside on the wrong shard given the configured zones for the sharded cluster.修改区域后,平衡器必须根据新的值范围将块迁移到适当的区域。在平衡完成之前,根据分片集群的配置区域,一些块可能会驻留在错误的分片上。
Before you Begin开始之前
To complete this tutorial, you must deploy a sharded cluster with a sharded collection and create a zone to modify.要完成本教程,您必须部署一个具有分片集合的分片集群,并创建一个要修改的区域。
This example uses a sharded collection named 此示例使用users in the records database, sharded by the zipcode field.records数据库中名为users的分片集合,由zipcode字段分片。
Steps步骤
The following procedure modifies the range of 以下过程将zipcode values for the NYC zone to be 11201 through 11240.NYC区域的zipcode范围修改为11201到11240。