Skip to content

Commit 8da1841

Browse files
DOCS-15748 Fix Mongosync Atlas doc examples (#276)
* DOCS-15748 Fix Mongosync Atlas doc examples * DOCS-15740 updates for KD's feedback * DOCS-15748 updates for feedback
1 parent 789b5d6 commit 8da1841

7 files changed

+187
-27
lines changed

source/connecting/atlas-to-atlas.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ This page provides instructions to connect Atlas clusters using
1919
Atlas cluster, see :ref:`Connect to a Database Deployment
2020
<atlas-connect-to-deployment>`
2121

22+
Considerations
23+
--------------
24+
25+
- Both the source and destination Atlas clusters must use MongoDB 6.0 or
26+
later.
27+
- ``mongosync`` supports replica sets and sharded clusters.
28+
- ``mongosync`` **doesn't** support Atlas shared clusters or serverless
29+
instances. You can use ``mongosync`` only with M10 or higher Atlas
30+
clusters.
31+
2232
Connection Strings
2333
------------------
2434

@@ -53,4 +63,5 @@ Limitations
5363
Example
5464
-------
5565

56-
.. include:: /includes/example-connect-atlas.rst
66+
.. include:: /includes/example-connect-atlas-to-atlas.rst
67+

source/connecting/onprem-to-atlas.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ For additional details on connecting to an Atlas cluster, see
2424
Connection Strings
2525
------------------
2626

27+
.. include:: /includes/fact-connection-strings-onprem
2728
.. include:: /includes/fact-connection-strings-atlas
2829

2930
Authentication
@@ -61,4 +62,5 @@ Limitations
6162
Example
6263
-------
6364

64-
.. include:: /includes/example-connect-onprem-atlas.rst
65+
.. include:: /includes/example-connect-onprem-to-atlas.rst
66+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Gather Connection Information
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The generic connection string format is:
5+
6+
.. code-block:: shell
7+
8+
mongodb://<user>:<password>@<clusterName>.<hostname>.mongodb.net/
9+
10+
You can get the connection string for the Atlas clusters from the Atlas
11+
UI. To learn more, see :atlas:`Connect to a Database Deployment
12+
</connect-to-database-deployment/>`.
13+
14+
The connection strings you gathered for ``cluster0`` and ``cluster1``
15+
should resemble the following:
16+
17+
.. code-block:: shell
18+
19+
cluster0:
20+
mongodb+srv://clusterAdmin:[email protected]
21+
cluster1:
22+
mongodb+srv://clusterAdmin:[email protected]
23+
24+
There is an database administrative user ``clusterAdmin`` with the
25+
password ``superSecret`` in the project that contains the clusters.
26+
27+
Connect the Source and Destination Clusters with ``mongosync``
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
30+
The ``mongosync`` command layout below is modified for display. To
31+
connect ``cluster0`` to ``cluster1`` with ``mongosync``, enter the
32+
following command on one line:
33+
34+
.. code-block:: shell
35+
36+
mongosync \
37+
--cluster0 "mongodb+srv://clusterAdmin:[email protected]" \
38+
--cluster1 "mongodb+srv://clusterAdmin:[email protected]"
39+
40+
Atlas clusters require TLS connections. To use ``mongosync`` with Atlas
41+
clusters, you add the :urioption:`tls=true <tls>` option. For example,
42+
to connect to the ``admin`` database on ``cluster0`` and ``cluster1``:
43+
44+
.. code-block:: shell
45+
46+
mongosync \
47+
--cluster0 "mongodb+srv://clusterAdmin:[email protected]/admin?tls=true" \
48+
--cluster1 "mongodb+srv://clusterAdmin:[email protected]/admin?tls=true"
49+
50+
You can also use ``mongodb+srv`` connection strings with ``mongosync``.
51+
You do not need to add the :urioption:`tls=true <tls>` option to a
52+
``mongodb+srv`` connection string. For example:
53+
54+
.. code-block:: shell
55+
56+
mongosync \
57+
--cluster0 "mongodb+srv://clusterAdmin:[email protected]/" \
58+
--cluster1 "mongodb+srv://clusterAdmin:[email protected]/"
59+
60+
For more details about ``mongodb+srv`` connection strings, see
61+
:ref:`connections-dns-seedlist`.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Gather Connection Information
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The source cluster, :setting:`cluster0`, is hosted on the following
5+
servers and ports:
6+
7+
- ``clusterOne01.fancyCorp.com:20020``
8+
- ``clusterOne02.fancyCorp.com:20020``
9+
- ``clusterOne03.fancyCorp.com:20020``
10+
11+
The destination Atlas cluster, :setting:`cluster1`, is hosted on the
12+
following servers and ports:
13+
14+
- ``cluster2Name-01.abc123.com:27017``
15+
- ``cluster2Name-02.abc123.com:27017``
16+
- ``cluster2Name-03.abc123.com:27017``
17+
18+
There is an administrative user, ``clusterAdmin`` configured on each
19+
cluster with password, ``superSecret``.
20+
21+
Connect the Source and Destination Clusters with ``mongosync``
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+
The generic connection string format for the self-managed cluster is:
25+
26+
.. code-block:: shell
27+
28+
mongodb://<user>:<password>@<ip-address>:<port>,<ip-address>:<port>,<ip-address>:<port>
29+
30+
The generic connection string format for the Atlas cluster is:
31+
32+
.. code-block:: shell
33+
34+
mongodb://<user>:<password>@<clusterName>.<hostname>.mongodb.net/
35+
36+
Use the connection information you gathered for the self-managed cluster
37+
to create the connection strings for ``cluster0``:
38+
39+
.. code-block:: text
40+
41+
cluster0:
42+
mongodb://clusterAdmin:[email protected]:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020
43+
44+
You can get the connection string for the Atlas cluster from the Atlas
45+
UI. To learn more, see :atlas:`Connect to a Database Deployment
46+
</connect-to-database-deployment/>`.
47+
48+
The ``mongosync`` command layout below is modified for display. To
49+
connect ``cluster0`` to ``cluster1`` with ``mongosync``, enter the
50+
following command on one line:
51+
52+
.. code-block:: shell
53+
54+
mongosync \
55+
--cluster0 "mongodb://clusterAdmin:[email protected]:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020" \
56+
--cluster1 "mongodb://clusterAdmin:[email protected]"
57+
58+
Atlas clusters require TLS connections. To use ``mongosync`` with Atlas
59+
clusters, you add the :urioption:`tls=true <tls>` option. For example,
60+
to connect to the ``admin`` database on ``cluster0`` and ``cluster1``:
61+
62+
.. code-block:: shell
63+
64+
mongosync \
65+
--cluster0 "mongodb://clusterAdmin:[email protected]:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/admin?tls=true" \
66+
--cluster1 "mongodb://clusterAdmin:[email protected]/admin?tls=true"
67+
68+
You can also use ``mongodb+srv`` connection strings with ``mongosync``.
69+
You do not need to add the :urioption:`tls=true <tls>` option to a
70+
``mongodb+srv`` connection string. For example:
71+
72+
.. code-block:: shell
73+
74+
mongosync \
75+
--cluster0 "mongodb+srv://clusterAdmin:[email protected]/" \
76+
--cluster1 "mongodb+srv://clusterAdmin:[email protected]/"
77+
78+
For more details about ``mongodb+srv`` connection strings, see
79+
:ref:`connections-dns-seedlist`.

source/includes/example-connect.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ following command on one line:
4747
--cluster0 "mongodb://clusterAdmin:[email protected]:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020" \
4848
--cluster1 "mongodb://clusterAdmin:[email protected]:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020"
4949
50-
Atlas clusters require TLS connections. To use ``mongosync`` with Atlas
51-
clusters, you add the :urioption:`tls=true <tls>` option. For example,
52-
to connect to the ``admin`` database on ``cluster0`` and ``cluster1``:
53-
54-
.. code-block:: shell
55-
56-
mongosync \
57-
--cluster0 "mongodb://clusterAdmin:[email protected]:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/admin?tls=true" \
58-
--cluster1 "mongodb://clusterAdmin:[email protected]:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/admin?tls=true"
59-
6050
You can also use ``mongodb+srv`` connection strings with ``mongosync``.
6151
You do not need to add the :urioption:`tls=true <tls>` option to a
6252
``mongodb+srv`` connection string. For example:
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
:ref:`mongosync <c2c-mongosync>` uses a :ref:`MongoDB URI
2-
connection string <mongodb-uri>` to connect clusters:
2+
connection string <mongodb-uri>` to connect Atlas clusters:
33

44
- The SRV connection scheme has the form:
55

66
.. code-block:: none
77
8-
mongodb+srv://[username:password@][host.domain.TLD][/defaultauthdb][?options]
8+
mongodb+srv://[username:password]@[clusterName].[host].mongodb.net/
99
1010
For information on how to find your SRV connection
1111
string in Atlas, see :atlas:`Connect to Your Cluster
@@ -15,17 +15,7 @@ connection string <mongodb-uri>` to connect clusters:
1515

1616
.. code-block:: none
1717
18-
mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
18+
mongodb://[username:password]@[clusterName].[host].mongodb.net/
1919
20-
Specify the hostnames of the :binary:`mongod` instances the same way
21-
that they are listed in your replica set configuration.
22-
23-
For :ref:`sharded clusters <sharding-sharded-cluster>`, specify the
24-
hostnames of the :binary:`mongos` instances instead of the
25-
:binary:`mongod` instances.
26-
27-
.. note::
28-
29-
``mongosync`` does not require the :urioption:`replicaSet` option.
30-
31-
.. include:: /includes/read-preference-connection-string.rst
20+
.. include:: /includes/read-preference-connection-string.rst
21+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
:ref:`mongosync <c2c-mongosync>` uses a :ref:`MongoDB URI
2+
connection string <mongodb-uri>` to connect self-managed clusters:
3+
4+
- The SRV connection scheme has the form:
5+
6+
.. code-block:: none
7+
8+
mongodb+srv://[username:password@][host.domain.TLD][/defaultauthdb][?options]
9+
10+
- The standard URI connection scheme has the form:
11+
12+
.. code-block:: none
13+
14+
mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
15+
16+
Specify the hostnames of the :program:`mongod` instances the same way
17+
that they are listed in your replica set configuration.
18+
19+
For :ref:`sharded clusters <sharding-sharded-cluster>`, specify the
20+
hostnames of the :program:`mongos` instances instead of the
21+
:program:`mongod` instances.
22+
23+
.. note::
24+
25+
``mongosync`` does not require the :urioption:`replicaSet` option.
26+
27+
.. include:: /includes/read-preference-connection-string.rst

0 commit comments

Comments
 (0)