Skip to content

Commit 8f40799

Browse files
DOCS-41102 added code snippets cutover page (#341)
* DOCS-41102 * DOCSP-41102 added to quickstart * DOCSP-41102
1 parent b50f807 commit 8f40799

File tree

2 files changed

+126
-7
lines changed

2 files changed

+126
-7
lines changed

Diff for: source/quickstart.txt

+9
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ documentation provides details on using the following endpoints:
247247
* - :ref:`c2c-api-reverse`
248248
- Reverses the direction of a committed sync operation.
249249

250+
Finalize Cutover Process
251+
------------------------
252+
253+
You can finalize a migration and transfer your application
254+
workload from the source to the destination cluster using the
255+
``mongosync`` cutover process.
256+
257+
For more information, see :ref:`c2c-cutover-process`.
258+
250259
One-Time Sync
251260
-------------
252261

Diff for: source/reference/cutover-process.txt

+117-7
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,29 @@ Steps
3636
Ensure that the ``mongosync`` process status indicates the
3737
following values:
3838

39+
- ``canCommit`` is ``true``.
40+
3941
- ``lagTimeSeconds`` is small (near ``0``).
4042

4143
If ``lagTimeSeconds`` isn't close to ``0`` when the cutover
4244
starts, cutover might take a long time.
4345

44-
- ``canCommit`` is ``true``.
46+
The following example returns the status of the synchronization process.
47+
48+
Request
49+
~~~~~~~
50+
51+
.. literalinclude:: /includes/api/requests/progress.sh
52+
:language: shell
53+
54+
Response
55+
~~~~~~~~
56+
57+
.. literalinclude:: /includes/api/responses/progress.json
58+
:language: json
59+
:copyable: false
60+
:emphasize-lines: 5, 8
61+
4562

4663
.. step:: Stop any write operations to the synced collections on the source.
4764

@@ -50,8 +67,16 @@ Steps
5067
the entire source cluster during the commit (step 4) for you.
5168
- If you didn't start ``mongosync`` with
5269
``enableUserWriteBlocking``, ensure that writes are disabled.
53-
For example, run the ``setUserWriteBlockMode`` command on the
54-
source cluster.
70+
For example, run the :dbcommand:`setUserWriteBlockMode` command on the
71+
source cluster:
72+
73+
.. code-block:: javascript
74+
75+
db.adminCommand( {
76+
setUserWriteBlockMode: 1,
77+
global: true
78+
} )
79+
5580
- If ``mongosync`` uses filtered sync, it's not necessary to
5681
disable writes to the entire source cluster. But you must ensure
5782
that write operations are stopped for the collections included
@@ -63,19 +88,67 @@ Steps
6388
migration, you must issue a commit request for each ``mongosync``
6489
instance.
6590

91+
Request
92+
~~~~~~~~
93+
94+
.. literalinclude:: /includes/api/requests/commit.sh
95+
:language: shell
96+
97+
Response
98+
~~~~~~~~
99+
100+
.. literalinclude:: /includes/api/responses/success.json
101+
:language: json
102+
:copyable: false
103+
66104
.. note::
67105

68-
Ensure that the ``mongosync`` process response for the
69-
``commit`` request indicates that the ``mongosync`` state is
70-
``COMMITTING`` or ``COMMITTED``, which is the correct
71-
``mongosync`` state when you send a ``commit`` request.
106+
After you submit a ``commit`` request, call the ``progress`` endpoint
107+
to ensure that the ``mongosync`` state is ``COMMITTING`` or
108+
``COMMITTED``.
72109

73110
.. step:: Wait until you can perform writes on the destination cluster.
74111

75112
Call the ``progress`` endpoint to determine if ``canWrite`` is
76113
``true``. If ``canWrite`` is ``false``, wait until ``progress``
77114
shows ``canWrite`` is ``true``.
78115

116+
Request
117+
~~~~~~~
118+
119+
.. literalinclude:: /includes/api/requests/progress.sh
120+
:language: shell
121+
122+
Response
123+
~~~~~~~~
124+
125+
.. code-block:: json
126+
:emphasize-lines: 6
127+
:copyable: false
128+
129+
{
130+
"progress":
131+
{
132+
"state":"COMMITTED",
133+
"canCommit":true,
134+
"canWrite":true,
135+
"info":"change event application",
136+
"lagTimeSeconds":0,
137+
"collectionCopy":
138+
{
139+
"estimatedTotalBytes":694,
140+
"estimatedCopiedBytes":694
141+
},
142+
"directionMapping":
143+
{
144+
"Source":"cluster0: localhost:27017",
145+
"Destination":"cluster1: localhost:27018"
146+
}
147+
},
148+
"success": true
149+
}
150+
151+
79152
.. step:: Verify data transfer.
80153

81154
Verify the successful sync of data from the source to the
@@ -102,6 +175,43 @@ Steps
102175
``mongosync`` state is ``COMMITTED``, the cutover process is
103176
complete.
104177

178+
Request
179+
~~~~~~~
180+
181+
.. literalinclude:: /includes/api/requests/progress.sh
182+
:language: shell
183+
184+
Response
185+
~~~~~~~~
186+
187+
.. code-block:: json
188+
:emphasize-lines: 4
189+
:copyable: false
190+
191+
{
192+
"progress":
193+
{
194+
"state":"COMMITTED",
195+
"canCommit":true,
196+
"canWrite":false,
197+
"info":"change event application",
198+
"lagTimeSeconds":0,
199+
"collectionCopy":
200+
{
201+
"estimatedTotalBytes":694,
202+
"estimatedCopiedBytes":694
203+
},
204+
"directionMapping":
205+
{
206+
"Source":"cluster0: localhost:27017",
207+
"Destination":"cluster1: localhost:27018"
208+
}
209+
},
210+
"success": true
211+
}
212+
213+
214+
105215
Learn More
106216
----------
107217

0 commit comments

Comments
 (0)