@@ -180,22 +180,32 @@ Initialization Notes
180
180
Synchronize Data Between Clusters
181
181
---------------------------------
182
182
183
- The command interface for ``mongosync`` is an HTTP server that
184
- publishes an HTTP API. To control ``mongosync``, use the API endpoints.
185
-
186
- The :ref:`start <c2c-api-start>` command initiates data synchronization.
183
+ The :ref:`start <c2c-api-start>` endpoint initiates data synchronization.
187
184
To start syncing, use ``curl`` or a similar program to issue the
188
- :ref:`start <c2c-api-start>` command :
185
+ :ref:`start <c2c-api-start>` request :
189
186
190
187
.. literalinclude:: /includes/api/requests/start.sh
191
188
:language: shell
192
189
193
- Once started, ``mongosync`` will synchronize existing data on the
194
- source cluster with the destination cluster. After the initial sync has
195
- completed, new writes to the source cluster will be synced with the
196
- destination cluster.
190
+ If the :ref:`start <c2c-api-start>` request is successful, ``mongosync``
191
+ returns ``{ "success": true }`` and starts to synchronize existing data on
192
+ the source cluster with the destination cluster. At this point,
193
+ ``mongosync`` enters the ``RUNNING`` state and applies subsequent source
194
+ cluster writes to the destination cluster.
195
+
196
+ To check the status of the sync, call the :ref:`progress
197
+ <c2c-api-progress>` endpoint:
198
+
199
+ .. literalinclude:: /includes/api/requests/progress.sh
200
+ :language: shell
201
+
202
+ If the ``progress`` response includes the
203
+ field ``canCommit: true``, the clusters are in sync and the destination
204
+ cluster continuously replicates data from the source cluster.
197
205
198
- The API documentation provides details on using the following endpoints:
206
+ The command interface for ``mongosync`` is an HTTP server that publishes
207
+ an HTTP API. To control ``mongosync``, use the API endpoints. The API
208
+ documentation provides details on using the following endpoints:
199
209
200
210
.. list-table::
201
211
:header-rows: 1
@@ -219,8 +229,37 @@ The API documentation provides details on using the following endpoints:
219
229
* - :ref:`c2c-api-reverse`
220
230
- Reverses the direction of a committed sync operation.
221
231
232
+ One-Time Sync
233
+ -------------
234
+
235
+ After initializing data synchronization, call the :ref:`progress
236
+ <c2c-api-progress>` endpoint to see the status of the synchronization
237
+ process:
238
+
239
+ .. literalinclude:: /includes/api/requests/progress.sh
240
+ :language: shell
241
+
242
+ For a one time sync, verify that the ``progress`` response includes the
243
+ following field values:
244
+
245
+ - ``state: "RUNNING"``
246
+ - ``canCommit: true``
247
+ - ``lagTimeSeconds`` is near ``0`` (*Recommended, but not required*)
248
+
249
+ Then, call the :ref:`commit <c2c-api-commit>` endpoint to commit the
250
+ synchronization operation to the destination cluster and stop continuous
251
+ replication:
252
+
253
+ .. literalinclude:: /includes/api/requests/commit.sh
254
+ :language: shell
255
+
256
+ If the ``commit`` request is successful, ``mongosync`` returns
257
+ ``{ "success": true }`` and enters the ``COMMITTING`` state. After the sync
258
+ is complete, ``mongosync`` enters the ``COMMITTED`` state and the
259
+ clusters are no longer in continuous sync.
260
+
222
261
Synchronization Notes
223
- ~~~~~~~~~~~~~~~~~~~~~
262
+ ---------------------
224
263
225
264
- The default port for the HTTP API is ``27182``. Use the ``--port``
226
265
option with ``mongosync`` to :ref:`configure another port
0 commit comments