Skip to content

Commit 827f71f

Browse files
(DOCSP-30104): Tutorial for modifying a shard zone (#7361) (#7367)
* (DOCSP-30104): Tutorial for modifying a shard zone * move file to correct location * remove duplicate toc entries * change learn more links * intro tweak * fix code formatting * remove monospace from step titles * remove punctuation from step * remove punctuation from step * fix step formatting * review feedback * change syntax highlighting * remove syntax highlighting
1 parent 14713e8 commit 827f71f

File tree

4 files changed

+112
-2
lines changed

4 files changed

+112
-2
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ toc_landing_pages = [
224224
"/storage",
225225
"/text-search",
226226
"/tutorial/insert-documents",
227+
"/tutorial/manage-shard-zone",
227228
"/tutorial/install-mongodb-enterprise-on-amazon",
228229
"/tutorial/install-mongodb-enterprise-on-debian",
229230
"/tutorial/install-mongodb-enterprise-on-os-x",

source/data-center-awareness.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,3 @@ Further Reading
5555
:hidden:
5656

5757
/core/workload-isolation
58-
/core/zone-sharding
59-
/tutorial/manage-shard-zone

source/tutorial/manage-shard-zone.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,8 @@ return any range associated to the ``NYC`` zone.
123123

124124
use config
125125
db.tags.find({ tag: "NYC" })
126+
127+
.. toctree::
128+
:hidden:
129+
130+
/tutorial/manage-shard-zone/update-existing-shard-zone
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
.. _sharding-update-existing-zone:
2+
3+
=============================
4+
Update an Existing Shard Zone
5+
=============================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
.. facet::
14+
:name: genre
15+
:values: tutorial
16+
17+
After you specify a range of values for a shard zone, you can update the
18+
shard zone range if your application's requirements change.
19+
20+
To update an existing shard zone, perform these steps:
21+
22+
#. Stop the :term:`balancer`.
23+
24+
#. Remove the old range from the zone.
25+
26+
#. Update the zone's range.
27+
28+
#. Restart the balancer.
29+
30+
About this Task
31+
---------------
32+
33+
- Zone ranges are inclusive of the lower boundary and exclusive of the
34+
upper boundary.
35+
36+
- After you modify a zone, the balancer must migrate chunks to the
37+
appropriate zones based on the new range of values. Until balancing
38+
completes, some chunks may reside on the wrong shard given the
39+
configured zones for the sharded cluster.
40+
41+
Before you Begin
42+
----------------
43+
44+
To complete this tutorial, you must :ref:`deploy a sharded cluster
45+
<sharding-procedure-setup>` with a sharded collection and create a zone
46+
to modify.
47+
48+
This example uses a sharded collection named ``users`` in the
49+
``records`` database, sharded by the ``zipcode`` field.
50+
51+
.. procedure::
52+
:style: normal
53+
54+
.. step:: Add a shard to a zone called NYC
55+
56+
.. code-block:: none
57+
58+
sh.addShardToZone(<shard name>, "NYC")
59+
60+
.. step:: Specify a range of zipcode values for the NYC zone
61+
62+
.. code-block:: javascript
63+
64+
sh.updateZoneKeyRange("records.users", { zipcode: "10001" }, { zipcode: "10281" }, "NYC" )
65+
66+
Steps
67+
-----
68+
69+
The following procedure modifies the range of ``zipcode`` values for the
70+
``NYC`` zone to be ``11201`` through ``11240``.
71+
72+
.. procedure::
73+
:style: normal
74+
75+
.. step:: Stop the balancer
76+
77+
.. code-block:: javascript
78+
79+
sh.stopBalancer()
80+
81+
.. step:: Remove the current NYC range from the zone
82+
83+
.. code-block:: javascript
84+
85+
sh.removeRangeFromZone("records.user", { zipcode: "10001" }, { zipcode: "10281" } )
86+
87+
.. step:: Update the zone key range for the NYC zone
88+
89+
.. code-block:: javascript
90+
91+
sh.updateZoneKeyRange("records.users", { zipcode: "11201" }, { zipcode: "11240" }, "NYC" )
92+
93+
.. step:: Restart the balancer
94+
95+
.. code-block:: javascript
96+
97+
sh.startBalancer()
98+
99+
Learn More
100+
----------
101+
102+
- :method:`sh.removeRangeFromZone()`
103+
104+
- :method:`sh.updateZoneKeyRange()`
105+
106+
- :ref:`workload-isolation`

0 commit comments

Comments
 (0)