|
| 1 | +.. _c2c-cutover-process: |
| 2 | + |
| 3 | +=============== |
| 4 | +Cutover Process |
| 5 | +=============== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :class: singlecol |
| 13 | + |
| 14 | +You can finalize a migration and transfer your application's writes from |
| 15 | +the source to the destination cluster using the ``mongosync`` cutover |
| 16 | +process. |
| 17 | + |
| 18 | +Procedure |
| 19 | +--------- |
| 20 | + |
| 21 | +.. procedure:: |
| 22 | + :style: normal |
| 23 | + |
| 24 | + .. step:: Verify the status of the :program:`mongosync` process. |
| 25 | + |
| 26 | + Call the :ref:`progress <c2c-api-progress>` endpoint to determine |
| 27 | + the status of ``mongosync`` before starting the cutover process. |
| 28 | + Ensure that the ``mongosync`` process status indicates the |
| 29 | + following values: |
| 30 | + |
| 31 | + - ``lagTimeSeconds`` is small (near ``0``). |
| 32 | + |
| 33 | + If ``lagTimeSeconds`` isn't close to ``0`` when the cutover |
| 34 | + starts, cutover might take a long time. |
| 35 | + |
| 36 | + - ``canCommit`` is ``true``. |
| 37 | + |
| 38 | + .. step:: Stop any write operations to the synced collections on the source. |
| 39 | + |
| 40 | + - If you started ``mongosync`` with ``enableUserWriteBlocking`` |
| 41 | + set to ``true``, ``mongosync`` blocks all write operations on |
| 42 | + the entire source cluster during the commit (step 4) for you. |
| 43 | + - If you didn't start ``mongosync`` with |
| 44 | + ``enableUserWriteBlocking``, ensure that writes are disabled. |
| 45 | + For example, run the ``setUserWriteBlockMode`` command on the |
| 46 | + source cluster. |
| 47 | + - If ``mongosync`` uses filtered sync, it's not necessary to |
| 48 | + disable writes to the entire source cluster. But you must ensure |
| 49 | + that write operations are stopped for the collections included |
| 50 | + by the filter. |
| 51 | + |
| 52 | + .. step:: Send a :ref:`commit <c2c-api-commit>` request to ``mongosync``. |
| 53 | + |
| 54 | + If you started multiple ``mongosync`` instances for your |
| 55 | + migration, you must issue a commit request for each ``mongosync`` |
| 56 | + instance. |
| 57 | + |
| 58 | + .. note:: |
| 59 | + |
| 60 | + Ensure that the ``mongosync`` process response for the |
| 61 | + ``commit`` request indicates that the ``mongosync`` state is |
| 62 | + ``COMMITTING`` or ``COMMITTED``, which is the correct |
| 63 | + ``mongosync`` state when you send a ``commit`` request. |
| 64 | + |
| 65 | + .. step:: Wait until you can perform writes on the destination cluster. |
| 66 | + |
| 67 | + Call the ``progress`` endpoint to determine if ``canWrite`` is |
| 68 | + ``true``. If ``canWrite`` is ``false``, wait until ``progress`` |
| 69 | + shows ``canWrite`` is ``true``. |
| 70 | + |
| 71 | + .. step:: Enable application writes on the destination cluster. |
| 72 | + |
| 73 | + To enable writes, update :dbcommand:`setUserWriteBlockMode`: |
| 74 | + |
| 75 | + .. code-block:: javascript |
| 76 | + |
| 77 | + db.adminCommand( |
| 78 | + { |
| 79 | + setUserWriteBlockMode: 1, |
| 80 | + global: false |
| 81 | + } |
| 82 | + ) |
| 83 | + |
| 84 | + .. step:: Call the ``progress`` endpoint to determine the status of the ``mongosync`` process. |
| 85 | + |
| 86 | + When the ``mongosync`` progress response indicates that the |
| 87 | + ``mongosync`` state is ``COMMITTED``, the cutover process is |
| 88 | + complete. |
0 commit comments