Skip to content

Commit ac92dd4

Browse files
DOCS-16527 replica set to sharded cluster page (#363) (#373)
* DOCSP-16527 * DOCS-16527 changed structure
1 parent d077322 commit ac92dd4

12 files changed

+206
-29
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ toc_landing_pages = ["/quickstart",
1616
"/installation",
1717
"reference/reference",
1818
"/connecting",
19+
"/topologies",
1920
"/using-mongosync",
2021
"/multiple-mongosyncs",
2122
"/release-notes/release-notes",

source/faq.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ when ``mongosync`` became unavailable.
104104

105105
.. include:: /includes/fact-restart-resume-delay.rst
106106

107+
.. _c2c-faq-arbiters:
108+
107109
Can the source or destination be a replica set with arbiters?
108110
-------------------------------------------------------------
109111

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. code-block:: shell
2+
3+
mongosync \
4+
--cluster0 "<cluster0_connection_string>" \
5+
--cluster1 "<cluster1_connection_string>"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- ``mongosync`` allows users to rename collections that the
2+
``sharding.shardingEntries`` option includes during sync with some
3+
limitations. For details, see
4+
:ref:`Renaming During Sync <rename-during-sync>`.
5+
- If you use the ``sharding.createSupportingIndexes`` option, the indexes are
6+
automatically created on the destination cluster during the sync. You cannot
7+
create these indexes afterwards on the source cluster.
8+
- If you want to create an index to support shard keys manually, you
9+
must create the index before ``mongosync`` starts or after the migration is
10+
complete and ``mongosync`` has stopped.

source/index.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ common questions users have asked about ``mongosync``.
4040
/about-mongosync
4141
/installation
4242
/connecting
43-
/multiple-mongosyncs
43+
/topologies
4444
/reference
4545
/release-notes
4646
/faq

source/quickstart.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ the rest of the {+c2c-product-name+} documentation.
3434

3535
- The destination cluster must be the same version or up to two versions ahead
3636
of the source cluster. The patch version is not important, so long as they
37-
meets the minimum patch :ref:`version requirements
37+
meet the minimum patch :ref:`version requirements
3838
<c2c-server-version-compatibility>`.
3939

4040
Follow the instructions below to set up {+c2c-product-name+}, connect
4141
your clusters, and synchronize your data.
4242

43+
.. _c2c-quickstart-setup:
44+
4345
Setup
4446
-----
4547

@@ -48,14 +50,18 @@ Setup
4850

4951
.. step:: Define a source and a destination cluster
5052

53+
.. _c2c-quickstart-define-clusters:
54+
5155
If you already have a MongoDB cluster, either self-managed or
5256
hosted in :atlas:`MongoDB Atlas </getting-started?jmp=docs>`,
5357
use that cluster as the source cluster. If you don't have a
5458
cluster to work with, you will need to create one.
5559

5660
This Quickstart works when the destination cluster and the source
57-
cluster are both replica sets. To sync from a replica set to a
58-
sharded cluster, or between sharded clusters, see:
61+
cluster are both replica sets.
62+
63+
To sync from a replica set to a sharded cluster, see
64+
:ref:`c2c-rs-to-sharded`. To sync between sharded clusters, see
5965
:ref:`c2c-sharded-clusters`.
6066

6167
.. seealso::
@@ -79,6 +85,8 @@ Setup
7985

8086
.. step:: Define administrative users
8187

88+
.. _c2c-quickstart-define-users:
89+
8290
If either cluster is hosted in Atlas, or if either of them
8391
requires authentication, you must create a database user that has
8492
permissions in both clusters.
@@ -116,6 +124,8 @@ Setup
116124

117125
.. step:: Download and install ``mongosync``
118126

127+
.. _c2c-quickstart-download:
128+
119129
``mongosync`` is the tool that connects the source and
120130
destination clusters. You can host ``mongosync`` on its own
121131
hardware, ``mongosync`` does not have to run on the hardware that
@@ -168,6 +178,8 @@ Connect the Clusters
168178

169179
.. step:: Initialize mongosync
170180

181+
.. _c2c-initialize:
182+
171183
``mongosync`` must create an initial connection to the source and
172184
destination clusters before it can start to sync data. To create the initial
173185
connection, issue the following command with your connection

source/reference/api/start.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ following configurations:
361361

362362
* Sync between sharded clusters that differ in the number of shards.
363363

364+
.. _c2c-shard-replica-sets:
364365

365366
Shard Replica Sets
366367
~~~~~~~~~~~~~~~~~~
@@ -371,7 +372,7 @@ Sync from a replica set to a sharded cluster requires the
371372
``sharding`` option. This option configures how ``mongosync`` shards
372373
collections.
373374

374-
The ``sharding.shardEntries`` array specifies the collections to shard.
375+
The ``sharding.shardingEntries`` array specifies the collections to shard.
375376
Collections that are not listed in this array replicate as unsharded.
376377

377378
Supporting Indexes
@@ -389,7 +390,7 @@ This is done by setting the ``sharding.createSupportingIndexes`` option.
389390

390391
When ``sharding.createSupportingIndexes`` is ``false`` (the default):
391392

392-
* Each shard key you provide for the ``sharding.shardEntries`` option
393+
* Each shard key you provide for the ``sharding.shardingEntries`` option
393394
must have an existing index on the source cluster.
394395

395396
* One of the indexes used for the shard key must have simple collation if the
@@ -422,7 +423,7 @@ Rename During Sync
422423

423424
.. versionadded:: 1.1
424425

425-
Collections listed in the ``sharding.shardEntries`` array
426+
Collections listed in the ``sharding.shardingEntries`` array
426427
when synced from a replica set to a sharded cluster
427428
become sharded collections on the destination cluster.
428429

source/reference/limitations.txt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,8 @@ Sharded Clusters
8787
- Sync from a replica set to a sharded cluster has the following
8888
limitations:
8989

90-
- ``mongosync`` allows users to rename collections that the
91-
``sharding.shardingEntries`` option for the :ref:`c2c-api-start`
92-
command includes during sync. To see limitations on renaming
93-
collections while ``mongosync`` is running, see :ref:`Renaming
94-
During Sync <rename-during-sync>`.
95-
- When using the ``sharding.createSupportingIndexes`` option to create
96-
indexes supporting shard keys on the destination cluster during
97-
sync, you cannot create these indexes afterwards on the source
98-
cluster.
99-
100-
The index must either exist before ``mongosync`` starts or be
101-
created after the migration is complete and ``mongosync`` has
102-
stopped.
103-
90+
.. include:: /includes/limitations-rs-to-sharded.rst
91+
10492
- Within a collection, the ``_id`` field must be unique across all of
10593
the shards in the cluster. See :ref:`sharded-clusters-unique-indexes`
10694
for more details.

source/reference/mongosync.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ The ``mongosync`` command layout below is modified for display. To
6262
connect ``cluster0`` to ``cluster1`` with ``mongosync``, enter the
6363
following command on one line:
6464

65-
.. code-block:: shell
66-
67-
mongosync \
68-
--cluster0 "<cluster0_connection_string>" \
69-
--cluster1 "<cluster1_connection_string>"
65+
.. include:: /includes/example-connection-string-general.rst
7066

7167
For more information on how to format your connection strings, see
7268
:ref:`c2c-connecting`.

source/topologies.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
============================
2+
Supported Cluster Topologies
3+
============================
4+
5+
.. contents:: On this page
6+
:local:
7+
:backlinks: none
8+
:depth: 1
9+
:class: singlecol
10+
11+
Cluster topology affects how nodes are arranged within a cluster. Topology
12+
impacts the availability and performance of your MongoDB deployment.
13+
14+
The topology you choose can affect how ``mongosync`` synchronizes data between
15+
clusters.
16+
17+
Requirements
18+
------------
19+
20+
:ref:`c2c-mongosync` supports two cluster topologies:
21+
22+
- :ref:`Replica sets <replication>`
23+
24+
- :ref:`Sharded clusters <sharded-cluster>`
25+
26+
If you are syncing a sharded cluster to another sharded cluster, they are not
27+
required to have the same number of shards.
28+
29+
``mongosync`` doesn't support sync from a sharded cluster to a replica set.
30+
31+
Get Started
32+
-----------
33+
34+
- To sync a replica set to a replica set, see the
35+
:ref:`Quick Start Guide <c2c-quickstart>`.
36+
37+
- To sync a replica set to a sharded cluster, see :ref:`c2c-rs-to-sharded`.
38+
39+
- To sync a sharded cluster to another sharded cluster, see
40+
:ref:`c2c-sharded-clusters`.
41+
42+
.. toctree::
43+
:titlesonly:
44+
45+
topologies/rs-to-sharded
46+
topologies/multiple-mongosyncs

source/multiple-mongosyncs.txt renamed to source/topologies/multiple-mongosyncs.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _c2c-sharded-clusters:
22

3-
=====================================
4-
Use ``mongosync`` on Sharded Clusters
5-
=====================================
3+
=====================
4+
Sync Sharded Clusters
5+
=====================
66

77
.. default-domain:: mongodb
88

source/topologies/rs-to-sharded.txt

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
.. _c2c-rs-to-sharded:
2+
3+
=======================================
4+
Sync a Replica Set to a Sharded Cluster
5+
=======================================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: twocols
12+
13+
This page outlines the procedure to synchronize data from a replica set to a
14+
sharded cluster using :program:`mongosync`.
15+
16+
.. note::
17+
18+
``mongosync`` doesn't support syncing from a sharded cluster to a replica
19+
set.
20+
21+
22+
Before You Begin
23+
----------------
24+
25+
- :ref:`Define <c2c-quickstart-define-clusters>` your source replica set and
26+
destination sharded cluster.
27+
28+
- :ref:`Define <c2c-quickstart-define-users>` an administrative user that has
29+
permissions in both clusters.
30+
31+
- :ref:`Download and install <c2c-quickstart-download>` ``mongosync``.
32+
33+
To learn more, see the :ref:`mongosync setup <c2c-quickstart-setup>`
34+
instructions.
35+
36+
Steps
37+
-----
38+
39+
.. procedure::
40+
:style: normal
41+
42+
.. step:: Connect the replica set and sharded cluster
43+
44+
``mongosync`` must create an initial connection between the source
45+
replica set and the destination sharded cluster before you can start to
46+
sync data.
47+
48+
To connect ``cluster0`` to ``cluster1`` with ``mongosync``, enter the
49+
following command:
50+
51+
.. include:: /includes/example-connection-string-general.rst
52+
53+
Follow the :ref:`connection instructions <c2c-conn-top-level>`
54+
for your cluster architecture to format your connection strings and
55+
connect to the :binary:`mongos` instance in your cluster.
56+
57+
.. step:: Start synchronization
58+
59+
Call the :ref:`start <c2c-api-start>` endpoint to initiate data
60+
synchronization.
61+
62+
To sync from a replica set to a sharded cluster, set the
63+
``sharding`` option for the ``start`` command to shard collections on
64+
the destination cluster. For more information, see
65+
:ref:`Sharding Parameters <c2c-api-start-sharding>`.
66+
67+
Use the ``sharding.shardingEntries`` parameter to specify the collections
68+
to shard. Collections that you do not list in this array replicate as
69+
unsharded. For more information, see
70+
:ref:`Shard Replica Sets <c2c-shard-replica-sets>` and
71+
:ref:`sharding-shard-key-selection`.
72+
73+
The following example starts a sync from a replica set to a sharded
74+
cluster:
75+
76+
Request
77+
~~~~~~~
78+
79+
.. literalinclude:: /includes/api/requests/start-rs-shard.sh
80+
81+
Response
82+
~~~~~~~~
83+
84+
.. literalinclude:: /includes/api/responses/success.json
85+
:language: json
86+
:copyable: false
87+
88+
Next Steps
89+
----------
90+
91+
You can finalize a migration and transfer your application workload from the
92+
source to the destination cluster using the ``mongosync`` cutover process.
93+
94+
Limitations
95+
-----------
96+
97+
- You cannot use the :ref:`reverse <c2c-api-reverse>` endpoint between a
98+
replica set and a sharded cluster.
99+
100+
.. include:: /includes/limitations-rs-to-sharded.rst
101+
102+
- If the source replica set has :ref:`arbiters <c2c-faq-arbiters>`, the source
103+
replica set must have more than 2 non-arbiter nodes and you must sync from a
104+
non-arbiter node.
105+
106+
For more details, see :ref:`c2c-limitations`.
107+
108+
Learn More
109+
----------
110+
111+
- :ref:`c2c-quickstart`
112+
- :ref:`Sync Sharded Clusters <c2c-sharded-clusters>`
113+
- :ref:`About mongosync <about-mongosync>`
114+
- :ref:`mongosync <c2c-mongosync>`
115+
- :ref:`mongosync States <c2c-states>`
116+

0 commit comments

Comments
 (0)