Skip to content

Commit fbf3db6

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

12 files changed

+207
-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
@@ -41,7 +41,7 @@ common questions users have asked about ``mongosync``.
4141
/about-mongosync
4242
/installation
4343
/connecting
44-
/multiple-mongosyncs
44+
/topologies
4545
/reference
4646
/release-notes
4747
/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::
@@ -81,6 +87,8 @@ Setup
8187

8288
.. step:: Define administrative users
8389

90+
.. _c2c-quickstart-define-users:
91+
8492
If either cluster is hosted in Atlas, or if either of them
8593
requires authentication, you must create a database user that has
8694
permissions in both clusters.
@@ -118,6 +126,8 @@ Setup
118126

119127
.. step:: Download and install ``mongosync``
120128

129+
.. _c2c-quickstart-download:
130+
121131
``mongosync`` is the tool that connects the source and
122132
destination clusters. You can host ``mongosync`` on its own
123133
hardware, ``mongosync`` does not have to run on the hardware that
@@ -170,6 +180,8 @@ Connect the Clusters
170180

171181
.. step:: Initialize mongosync
172182

183+
.. _c2c-initialize:
184+
173185
``mongosync`` must create an initial connection to the source and
174186
destination clusters before it can start to sync data. To create the initial
175187
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
@@ -349,6 +349,7 @@ following configurations:
349349

350350
* Sync between sharded clusters that differ in the number of shards.
351351

352+
.. _c2c-shard-replica-sets:
352353

353354
Shard Replica Sets
354355
~~~~~~~~~~~~~~~~~~
@@ -359,7 +360,7 @@ Sync from a replica set to a sharded cluster requires the
359360
``sharding`` option. This option configures how ``mongosync`` shards
360361
collections.
361362

362-
The ``sharding.shardEntries`` array specifies the collections to shard.
363+
The ``sharding.shardingEntries`` array specifies the collections to shard.
363364
Collections that are not listed in this array replicate as unsharded.
364365

365366
Supporting Indexes
@@ -377,7 +378,7 @@ This is done by setting the ``sharding.createSupportingIndexes`` option.
377378

378379
When ``sharding.createSupportingIndexes`` is ``false`` (the default):
379380

380-
* Each shard key you provide for the ``sharding.shardEntries`` option
381+
* Each shard key you provide for the ``sharding.shardingEntries`` option
381382
must have an existing index on the source cluster.
382383

383384
* One of the indexes used for the shard key must have simple collation if the
@@ -410,7 +411,7 @@ Rename During Sync
410411

411412
.. versionadded:: 1.1
412413

413-
Collections listed in the ``sharding.shardEntries`` array
414+
Collections listed in the ``sharding.shardingEntries`` array
414415
when synced from a replica set to a sharded cluster
415416
become sharded collections on the destination cluster.
416417

source/reference/limitations.txt

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

93-
- ``mongosync`` allows users to rename collections that the
94-
``sharding.shardingEntries`` option for the :ref:`c2c-api-start`
95-
command includes during sync. To see limitations on renaming
96-
collections while ``mongosync`` is running, see :ref:`Renaming
97-
During Sync <rename-during-sync>`.
98-
- When using the ``sharding.createSupportingIndexes`` option to create
99-
indexes supporting shard keys on the destination cluster during
100-
sync, you cannot create these indexes afterwards on the source
101-
cluster.
102-
103-
The index must either exist before ``mongosync`` starts or be
104-
created after the migration is complete and ``mongosync`` has
105-
stopped.
106-
93+
.. include:: /includes/limitations-rs-to-sharded.rst
94+
10795
- Within a collection, the ``_id`` field must be unique across all of
10896
the shards in the cluster. See :ref:`sharded-clusters-unique-indexes`
10997
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: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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``
93+
:ref:`cutover process <c2c-cutover-process>`.
94+
95+
Limitations
96+
-----------
97+
98+
- You cannot use the :ref:`reverse <c2c-api-reverse>` endpoint between a
99+
replica set and a sharded cluster.
100+
101+
.. include:: /includes/limitations-rs-to-sharded.rst
102+
103+
- If the source replica set has :ref:`arbiters <c2c-faq-arbiters>`, the source
104+
replica set must have more than 2 non-arbiter nodes and you must sync from a
105+
non-arbiter node.
106+
107+
For more details, see :ref:`c2c-limitations`.
108+
109+
Learn More
110+
----------
111+
112+
- :ref:`c2c-quickstart`
113+
- :ref:`Sync Sharded Clusters <c2c-sharded-clusters>`
114+
- :ref:`About mongosync <about-mongosync>`
115+
- :ref:`mongosync <c2c-mongosync>`
116+
- :ref:`mongosync States <c2c-states>`
117+

0 commit comments

Comments
 (0)