@@ -24,7 +24,7 @@ sharding in MongoDB deployments.
24
24
25
25
.. note::
26
26
27
- Shard key tags are entirely distinct from :ref:`replica set member
27
+ Shard key rage tags are entirely distinct from :ref:`replica set member
28
28
tags <replica-set-read-preference-tag-sets>`.
29
29
30
30
Behavior and Operations
@@ -33,20 +33,19 @@ Behavior and Operations
33
33
Tags in a sharded cluster are pieces of metadata that dictate the
34
34
policy and behavior of the cluster balancer :term:`balancer`. Using
35
35
tags, you may associate individual shards in a cluster with one or
36
- more strings, or tags. Then, you can assign this tag string to a range
36
+ more tags. Then, you can assign this tag string to a range
37
37
of :term:`shard key` values for a sharded collection. When migrating a
38
38
chunk, the balancer will select a destination shard based on the
39
39
configured tag ranges.
40
40
41
- To migrate chunks in a tagged environment, the balancer selects a
42
- target shard with a tag range that has an *upper* bound that *greater
43
- than* the migrating chunk's *lower* bound. If a shard with a matching
44
- tagged range exists, the balancer will migrate the chunk to that
45
- shard.
41
+ The balancer migrates chunks in tagged ranges to shards with those
42
+ tags, if tagged shards are not balanced. [#specific-tagged-migrations]_
46
43
47
- .. note:: The balancer may migrate chunks to tagged shards that
48
- contain values that exceed the upper bound of the selected tag
49
- range.
44
+ .. note::
45
+
46
+ Because a single chunk may span different tagged shard key ranges,
47
+ the balancer may migrate chunks to tagged shards that contain
48
+ values that exceed the upper bound of the selected tag range.
50
49
51
50
.. example::
52
51
@@ -63,11 +62,20 @@ shard.
63
62
values ranging between ``150`` and ``220`` to a shard tagged
64
63
``NYC``, since ``150`` is closer to ``200`` than ``300``.
65
64
66
- After configuring shard tags, the cluster may take some time to
67
- reach the proper distribution of data, depending on the division of
68
- chunks (i.e. splits) and the current distribution of data in the
69
- cluster. Once configured, the balancer will respect tag ranges during
70
- future :ref:`balancing rounds <sharding-internals-balancing>`.
65
+ After configuring tags on shards and ranges of the shard key, the
66
+ cluster may take some time to reach the proper distribution of data,
67
+ depending on the division of chunks (i.e. splits) and the current
68
+ distribution of data in the cluster. Once configured, the balancer
69
+ will respect tag ranges during future :ref:`balancing rounds
70
+ <sharding-internals-balancing>`.
71
+
72
+ .. [#specific-tagged-migrations] To migrate chunks in a tagged
73
+ environment, the balancer selects a target shard with a tag range
74
+ that has an *upper* bound that is *greater than* the migrating
75
+ chunk's *lower* bound. If a shard with a matching tagged range
76
+ exists, the balancer will migrate the chunk to that shard.
77
+
78
+
71
79
72
80
Administer Shard Tags
73
81
---------------------
@@ -101,11 +109,11 @@ the ``NRT`` tag from a shard:
101
109
Tag a Shard Key Range
102
110
~~~~~~~~~~~~~~~~~~~~~
103
111
104
- To assign a range of shard key values to a tag, use the
112
+ To assign a tag to a range of shard keys use the
105
113
:method:`sh.addTagRange()` method when connected to a
106
114
:program:`mongos` instance. Any given shard key range may only have
107
- *one* assigned tag. However, you may assign the same tag to multiple
108
- shard key rage .
115
+ *one* assigned tag. You cannot overlap defined ranges, or tag the same
116
+ range more than once .
109
117
110
118
.. example::
111
119
@@ -122,6 +130,11 @@ shard key rage.
122
130
sh.addTagRange("records.users", { zipcode: "11201" }, { zipcode: "11240" }, "NYC")
123
131
sh.addTagRange("records.users", { zipcode: "94102" }, { zipcode: "94135" }, "SFO")
124
132
133
+ .. note::
134
+
135
+ Shard rages are always inclusive of the lower value and exclusive
136
+ of the upper boundary.
137
+
125
138
Remove a Tag From a Shard Key Range
126
139
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127
140
0 commit comments