Skip to content

DOCS-8106: Tag Aware High Availibility Writes #2729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions source/images/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,17 @@ output:
---
name: sharding-tiered-slas-tags
alt: "Diagram of sharded cluster architecture for tiered SLA"
output:
- type: print
tag: 'print'
dpi: 300
width: 900
- type: web
dpi: 72
width: 700
---
name: sharded-cluster-high-availability-architecture
alt: "Diagram of sharded cluster architecture for high availability"
output:
- type: print
tag: 'print'
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions source/includes/steps-sharding-high-availability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
stepnum: 1
title: Tag each shard.
level: 4
ref: sharding-high-availability-tag-shards
action:
- pre: |
Tag each shard in the ``alfa`` data center with the ``alfa`` tag.
language: javascript
code: |
sh.addShardTag("shard0000", "alfa")
- pre: |
Tag each shard in the ``bravo`` data center with the ``bravo`` tag.
language: javascript
code: |
sh.addShardTag("shard0001", "bravo")
post: |
You can review the tags assigned to any given shard by running
:method:`sh.status()`.
---
stepnum: 2
title: Define ranges for each tag.
level: 4
ref: sharding-high-availability-tag-ranges
action:
- pre: |
Define the range for the ``alfa`` database and associate it to the ``alfa``
tag using the :method:`sh.addTagRange()` method. This method requires:

* The full namespace of the target collection.

* The inclusive lower bound of the range.

* The exclusive upper bound of the range.

* The name of the tag.

language: javascript
code: |
sh.addTagRange(
"<database>.<collection>",
{ "datacenter" : "alfa", "userid" : MinKey },
{ "datacenter" : "alfa", "userid" : MaxKey },
"alfa"
)
- pre: |
Define the range for the ``bravo`` database and associate it to the
``bravo`` tag using the :method:`sh.addTagRange()` method. This method
requires:

* The full namespace of the target collection.

* The inclusive lower bound of the range.

* The exclusive upper bound of the range.

* The name of the tag.

language: javascript
code: |
sh.addTagRange(
"<database>.<collection>",
{ "datacenter" : "bravo", "userid" : MinKey },
{ "datacenter" : "bravo", "userid" : MaxKey },
"bravo"
)
post: |
The :bsontype:`MinKey` and :bsontype:`MaxKey` values are reserved special
values for comparisons. :bsontype:`MinKey` always compares as less than
every other possible value, while :bsontype:`MaxKey` always compares as
greater than every other possible value. The configured ranges capture every
user for each ``datacenter``.
---
stepnum: 3
title: Review the changes.
level: 4
ref: sharding-high-availability-review
pre: |
The next time the :ref:`balancer <sharding-balancing>` runs, it
:ref:`splits <sharding-chunk-split>` and
:ref:`migrates <sharding-chunk-migration>` chunks across the
shards respecting the tag ranges and tags.

Once balancing finishes, the shards tagged as ``alfa`` should only
contain documents with ``datacenter : alfa``, while shards tagged as
``bravo`` should only contain documents with ``datacenter : bravo``.

You can review the chunk distribution by running :method:`sh.status()`.
...
4 changes: 4 additions & 0 deletions source/includes/toc-sharding-tag-aware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ description: |
file: /tutorial/sharding-segmenting-shards
description: |
Segmenting Shards based on Application or Customer using Tag Aware Sharding
---
file: /tutorial/sharding-high-availability-writes
description: |
Tutorial on facilitating high availability writes using Tag Aware Sharding
...
2 changes: 2 additions & 0 deletions source/reference/read-preference.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _read-preference:

=========================
Read Preference Reference
=========================
Expand Down
Loading