|
| 1 | +title: "Download the latest |oldversion| binaries." |
| 2 | +level: 4 |
| 3 | +ref: 5.0-downgrade-binaries-sharded-cluster |
| 4 | +content: | |
| 5 | + Using either a package manager or a manual download, get the latest |
| 6 | + release in the |oldversion| series. If using a package manager, add a new |
| 7 | + repository for the |oldversion| binaries, then perform the actual downgrade |
| 8 | + process. |
| 9 | +
|
| 10 | + .. include:: /includes/downgrade-path.rst |
| 11 | +--- |
| 12 | +title: Disable the Balancer. |
| 13 | +level: 4 |
| 14 | +ref: disable-balancer |
| 15 | +content: | |
| 16 | + Connect a :binary:`~bin.mongo` shell to a :binary:`~bin.mongos` instance in |
| 17 | + the sharded cluster, and run :method:`sh.stopBalancer()` to |
| 18 | + disable the balancer: |
| 19 | +
|
| 20 | + .. code-block:: javascript |
| 21 | +
|
| 22 | + sh.stopBalancer() |
| 23 | +
|
| 24 | + .. note:: |
| 25 | +
|
| 26 | + If a migration is in progress, the system will complete the |
| 27 | + in-progress migration before stopping the balancer. You can run |
| 28 | + :method:`sh.isBalancerRunning()` to check the balancer's current |
| 29 | + state. |
| 30 | +
|
| 31 | + To verify that the balancer is disabled, run |
| 32 | + :method:`sh.getBalancerState()`, which returns false if the balancer |
| 33 | + is disabled: |
| 34 | +
|
| 35 | + .. code-block:: javascript |
| 36 | +
|
| 37 | + sh.getBalancerState() |
| 38 | +
|
| 39 | + For more information on disabling the balancer, see |
| 40 | + :ref:`sharding-balancing-disable-temporarily`. |
| 41 | +
|
| 42 | +--- |
| 43 | +title: "Downgrade the ``mongos`` instances." |
| 44 | +level: 4 |
| 45 | +ref: downgrade-mongos |
| 46 | +content: | |
| 47 | + Downgrade the binaries and restart. |
| 48 | +--- |
| 49 | +title: Downgrade each shard, one at a time. |
| 50 | +level: 4 |
| 51 | +ref: 5.0-downgrade-shard |
| 52 | +content: | |
| 53 | +
|
| 54 | + Downgrade the shards one at a time. |
| 55 | + |
| 56 | + A. Downgrade the shard's :ref:`secondary <replica-set-secondary-members>` |
| 57 | + members one at a time: |
| 58 | +
|
| 59 | + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst |
| 60 | +
|
| 61 | + #. Replace the |newversion| |
| 62 | + binary with the |oldversion| binary and restart. |
| 63 | +
|
| 64 | + #. Wait for the member to recover to ``SECONDARY`` state before |
| 65 | + downgrading the next secondary member. To check |
| 66 | + the member's state, connect a :binary:`~bin.mongo` shell to the shard |
| 67 | + and run :method:`rs.status()` method. |
| 68 | +
|
| 69 | + Repeat to downgrade for each secondary member. |
| 70 | +
|
| 71 | + #. Downgrade the shard :ref:`arbiter <replica-set-arbiter-configuration>`, if any. |
| 72 | +
|
| 73 | + Skip this step if the replica set does not include an arbiter. |
| 74 | +
|
| 75 | + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst |
| 76 | +
|
| 77 | + #. Delete the contents of the arbiter data directory. The |
| 78 | + :setting:`storage.dbPath` configuration setting or |
| 79 | + :option:`--dbpath <mongod --dbpath>` command line option specify the |
| 80 | + data directory of the arbiter :binary:`~bin.mongod`. |
| 81 | +
|
| 82 | + .. code-block:: bash |
| 83 | +
|
| 84 | + rm -rf /path/to/mongodb/datafiles/* |
| 85 | +
|
| 86 | + #. Replace the |newversion| binary with the |oldversion| binary and restart. |
| 87 | +
|
| 88 | + #. Wait for the member to recover to ``ARBITER`` state. To check |
| 89 | + the member's state, connect a :binary:`~bin.mongo` shell to the |
| 90 | + member and run :method:`rs.status()` method. |
| 91 | +
|
| 92 | + #. Downgrade the shard's primary. |
| 93 | +
|
| 94 | + 1. Step down the replica set primary. Connect a |
| 95 | + :binary:`~bin.mongo` shell to the primary and use |
| 96 | + :method:`rs.stepDown()` to step down the primary and force an |
| 97 | + election of a new primary: |
| 98 | +
|
| 99 | + .. code-block:: javascript |
| 100 | +
|
| 101 | + rs.stepDown() |
| 102 | +
|
| 103 | + #. Run :method:`rs.status()`. |
| 104 | +
|
| 105 | + .. code-block:: javascript |
| 106 | +
|
| 107 | + rs.status() |
| 108 | +
|
| 109 | + When the status shows that the primary has stepped down and |
| 110 | + another member has assumed ``PRIMARY`` state, proceed. |
| 111 | +
|
| 112 | + #. Run the following command from the :binary:`~bin.mongo` shell to |
| 113 | + perform a clean shutdown of the stepped-down primary, or refer to |
| 114 | + :ref:`terminate-mongod-processes` for additional ways to safely |
| 115 | + terminate the :binary:`~bin.mongod` process: |
| 116 | +
|
| 117 | + .. code-block:: javascript |
| 118 | +
|
| 119 | + db.adminCommand( { shutdown: 1 } ) |
| 120 | +
|
| 121 | + #. Replace the |newversion| |
| 122 | + binary with the |oldversion| binary and restart. |
| 123 | +
|
| 124 | + Repeat for the remaining shards. |
| 125 | +--- |
| 126 | +title: "Downgrade the config servers." |
| 127 | +level: 4 |
| 128 | +ref: 5.0-downgrade-config-servers |
| 129 | +content: |- |
| 130 | +
|
| 131 | + A. Downgrade the :ref:`secondary <replica-set-secondary-members>` |
| 132 | + members of the config servers replica set (CSRS) one at a time: |
| 133 | +
|
| 134 | + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst |
| 135 | +
|
| 136 | + #. Replace the |newversion| |
| 137 | + binary with the |oldversion| binary and restart. |
| 138 | +
|
| 139 | +
|
| 140 | + #. Wait for the member to recover to ``SECONDARY`` state before |
| 141 | + downgrading the next secondary member. To check |
| 142 | + the member's state, connect a :binary:`~bin.mongo` shell to the shard |
| 143 | + and run :method:`rs.status()` method. |
| 144 | +
|
| 145 | + Repeat to downgrade for each secondary member. |
| 146 | +
|
| 147 | + #. Step down the config server primary. |
| 148 | +
|
| 149 | + 1. Connect a :binary:`~bin.mongo` shell to the primary and use |
| 150 | + :method:`rs.stepDown()` to step down the primary and force an |
| 151 | + election of a new primary: |
| 152 | +
|
| 153 | + .. code-block:: javascript |
| 154 | +
|
| 155 | + rs.stepDown() |
| 156 | +
|
| 157 | + #. Run :method:`rs.status()`. |
| 158 | +
|
| 159 | + .. code-block:: javascript |
| 160 | +
|
| 161 | + rs.status() |
| 162 | +
|
| 163 | + When the status shows that the primary has stepped down and |
| 164 | + another member has assumed ``PRIMARY`` state, proceed. |
| 165 | + |
| 166 | + #. Run the following command from the :binary:`~bin.mongo` shell to |
| 167 | + perform a clean shutdown of the stepped-down primary, or refer to |
| 168 | + :ref:`terminate-mongod-processes` for additional ways to safely |
| 169 | + terminate the :binary:`~bin.mongod` process: |
| 170 | +
|
| 171 | + .. code-block:: javascript |
| 172 | +
|
| 173 | + db.adminCommand( { shutdown: 1 } ) |
| 174 | +
|
| 175 | + #. Replace the |newversion| |
| 176 | + binary with the |oldversion| binary and restart. |
| 177 | +
|
| 178 | +
|
| 179 | +--- |
| 180 | +title: "Re-enable the balancer." |
| 181 | +level: 4 |
| 182 | +ref: reenable-balancer |
| 183 | +content: | |
| 184 | +
|
| 185 | + Once the downgrade of sharded cluster components is complete, connect |
| 186 | + a :binary:`~bin.mongo` shell to a :binary:`~bin.mongos` and |
| 187 | + :ref:`re-enable the balancer <sharding-balancing-enable>`. |
| 188 | +
|
| 189 | + .. code-block:: javascript |
| 190 | +
|
| 191 | + sh.startBalancer() |
| 192 | +
|
| 193 | + The :binary:`~bin.mongo` shell method :method:`sh.startBalancer()` |
| 194 | + also enables auto-splitting for the sharded cluster. |
| 195 | +
|
| 196 | +... |
0 commit comments