@@ -4,14 +4,14 @@ Upgrade a Sharded Cluster from 2.2 to 2.4
4
4
5
5
.. default-domain:: mongodb
6
6
7
- Upgrading a sharded cluster from MongoDB version 2.2 to 2.4 (or 2.3)
7
+ Upgrading a :term:` sharded cluster` from MongoDB version 2.2 to 2.4 (or 2.3)
8
8
requires that you run a 2.4 :ref:`config server
9
- <sharding-config-server>` with the :option:`--upgrade <mongod
10
- --upgrade>` option, as explained in detail in this procedure. The
9
+ <sharding-config-server>` with the :option:`--upgrade <mongos --upgrade>` option,
10
+ as explained in detail in this procedure. The
11
11
upgrade can be run without downtime.
12
12
13
13
The upgrade to MongoDB 2.4 adds epochs to all of the collections and
14
- chunks in the existing cluster. The upgrade is reversible. MongoDB 2.2
14
+ chunks in the existing cluster. MongoDB 2.2
15
15
processes are capable of handling epochs, even though 2.2 did not
16
16
require them.
17
17
@@ -22,13 +22,15 @@ While the upgrade is in progress, you cannot make changes to the
22
22
collection metadata. For example, you cannot add shards, drop databases,
23
23
or drop collections, nor make other metadata changes.
24
24
25
- Upgrade a Sharded Cluster from MongoDB version 2.2 to MongoDB version 2.4
26
- -------------------------------------------------------------------------
25
+ .. _upgrade-cluster-upgrade:
26
+
27
+ Upgrade a Sharded Cluster from MongoDB 2.2 to MongoDB 2.4
28
+ ---------------------------------------------------------
27
29
28
30
Do not perform metadata operations while performing this procedure.
29
31
30
32
1. Turn off the :ref:`balancer <sharding-balancing-internals>` in the
31
- sharded cluster, as described in
33
+ :term:` sharded cluster` , as described in
32
34
:ref:`sharding-balancing-disable-temporally`.
33
35
34
36
#. Ensure there are no version 2.0 MongoDB processes still active in the
@@ -40,89 +42,104 @@ Do not perform metadata operations while performing this procedure.
40
42
#. Start a single versions 2.4 :program:`mongos` process with
41
43
:setting:`configdb` pointing to the sharded cluster's :ref:`config
42
44
servers <sharding-config-server>` and with the :option:`--upgrade
43
- <mongod --upgrade>` option.
45
+ <mongos --upgrade>` option. You can use an existing version 2.4
46
+ :program:`mongos` that is able to reach the config servers, or,
47
+ alternatively, you can start a new :program:`mongos` to avoid
48
+ reconfiguring a production :program:`mongos`.
49
+
50
+ Issue the command in the following form:
51
+
52
+ .. code-block:: sh
44
53
45
- You can use a new :program:`mongos` process, started on an ``admin``
46
- database, or use an existing version 2.4 :program:`mongos` process
47
- that is able to reach the :ref:`config servers
48
- <sharding-config-server>`.
54
+ mongos --configdb <config server> --upgrade
49
55
50
- Without the :option:`--upgrade <mongod --upgrade>` option, any
56
+ Without the :option:`--upgrade <mongos --upgrade>` option, any
51
57
version 2.4 :program:`mongos` processes in the sharded cluster will
52
58
fail to start.
53
59
60
+ The upgrade will prevent any chunk moves or splits from occurring
61
+ during the upgrade process. If there are very many sharded
62
+ collections, acquiring the locks for these collections may take
63
+ seconds or minutes. See the log for progress updates.
64
+
54
65
#. If the :program:`mongos` process starts successfully, the upgrade has
55
66
completed. If the :program:`mongos` process fails to start, check the
56
67
log as to why.
57
68
69
+ If a network interruption occurred and prevented changes, see
70
+ :ref:`upgrade-cluster-resyn`.
71
+
58
72
#. Restart the balancer. You can resume metadata operations.
59
73
60
- Once upgraded, introducing v2.0 MongoDB processes back into the sharded
61
- cluster can result in metadata problems - do not do this. In the future
62
- this will be prevented by the upgrade mechanism itself.
74
+ #. Restart the other version 2.4 :program:`mongos` processes in the
75
+ sharded cluster normally, without the :option:`--upgrade <mongos --upgrade>` option.
63
76
64
- The upgrade should require no manual intervention, and will prevent any
65
- chunk moves or splits from occurring during the upgrade process. If
66
- there are very many sharded collections, acquiring the locks for these
67
- collections may take seconds or minutes - the log will have progress
68
- updates.
77
+ Once you have upgraded, *do not* introduce version 2.0 MongoDB processes
78
+ back into the sharded cluster. This can result in metadata problems. In
79
+ future releases, this will be prevented by the upgrade mechanism itself.
69
80
70
- Once the upgrade process has completed successfully, it will be possible
71
- to start other v2.4 :program:`mongos` processes in the sharded cluster
72
- normally without the :option:`--upgrade <mongod --upgrade>` option.
81
+ .. _upgrade-cluster-resyn:
73
82
74
- Network Interruptions
75
- ---------------------
83
+ Resync after a Network Interruption
84
+ -----------------------------------
76
85
77
86
During the short critical section of the upgrade where changes are
78
87
applied, it is unlikely but possible that a network interruption will
79
88
prevent changes from being verified or applied to all three config
80
89
servers. If this occurs, the :ref:`config servers
81
90
<sharding-config-server>` must be re-synced, and there may be problems
82
- starting new mongoses . The sharded cluster will remain active, but
91
+ starting new :program:`mongos` processes . The :term:` sharded cluster` will remain active, but
83
92
manual metadata operations should be avoided until the re-sync. The
84
93
process for re-syncing is as follows:
85
94
86
- 1. Turn off the balancer in the sharded cluster and stop all metadata
87
- operations (this may already be the case due to preparations above).
95
+ 1. Turn off the :ref:`balancer <sharding-balancing-internals>` in the
96
+ sharded cluster and stop all metadata operations. This may already be
97
+ the case because of your having begun the upgrade procedure
98
+ (:ref:`upgrade-cluster-upgrade`).
88
99
89
- #. Shut down two of the three config servers, preferably the latter two
100
+ #. Shut down two of the three config servers, preferably the latter two listed
90
101
in the :setting:`configdb` string. For example, if your :setting:`configdb`
91
102
string is ``configA:27019,configB:27019,configC:27019``, shut down
92
103
``configB`` and ``configC``. Shutting down the last two config servers
93
104
ensures that metadata reads will be largely uninterrupted.
94
105
95
- #. :program:`Mongodump <mongodump>` the data files of the active config server (configA).
106
+ #. :program:`Mongodump <mongodump>` the data files of the active config server (``configA``).
107
+
108
+ #. Move the data files of the downed config servers (``configB`` and ``configC``)
109
+ to a backup location.
96
110
97
- #. Move the data files of the downed config servers (``configB``, ``configC``)
98
- to a backup location. Clear out the data directory.
111
+ #. Clear out the :term:`data directory <dbpath>`.
99
112
100
- #. Restart the downed config servers pointed at the now-empty data
101
- directory on a different port (for example, ``27020``).
113
+ #. Restart the downed config servers with :option:`--dbpath <mongod --dbpath>`
114
+ pointing to the now-empty data directory and :option:`--port <mongod --port>`
115
+ pointing to a different port (for example, ``27020``).
102
116
103
117
#. :program:`Mongorestore <mongorestore>` the data files from the active
104
118
config server (``configA``) to the restarted config servers on the new
105
- port (``configB:27020``, `` configC:27020``). These config servers are now
119
+ port (``configB:27020, configC:27020``). These config servers are now
106
120
re-synced.
107
121
108
- #. Restart the restored config servers on the new port, resetting the
109
- port back to the old settings (configB:27019,configC:27019).
122
+ #. Restart the restored config servers on the old port, resetting the
123
+ port back to the old settings (`` configB:27019,configC:27019`` ).
110
124
111
- #. Connection pooling may cause spurious failures as old connections
112
- are discarded only when used. This problem is fixed in v2.4, but to
113
- avoid this problem in v2.2, you can restart all mongoses (one-by-one,
114
- to avoid downtime) and stepDown and restart replica set primaries.
125
+ #. Connection pooling may cause spurious failures, as old connections
126
+ are discarded only when used. This problem is fixed in version 2.4, but to
127
+ avoid this problem in version 2.2, you can restart all :program:`mongos` instances (one-by-one,
128
+ to avoid downtime) and :method:`stepDown <rs.stepDown()>` and restart
129
+ the :term:`replica set` :term:`primaries <primary>`.
115
130
116
131
#. The sharded cluster is now fully resynced, but to retry the upgrade
117
- you must manually reset the upgrade state via a v2.2 mongos. To do so,
118
- run:
132
+ you must manually reset the upgrade state via a version 2.2
133
+ :program:`mongos`. To do so, connect to the 2.2 :program:`mongos`:
134
+
135
+ .. code-block:: sh
136
+
137
+ mongo <2.2 mongos port>
119
138
120
- .. code-block:: sh
139
+ And then run:
121
140
122
- # mongo <mongos>
141
+ .. code-block:: javascript
123
142
124
- > db.getMongo().getCollection("config.version").update({ _id : 1 }, { $unset : { upgradeState : 1 } })
143
+ db.getMongo().getCollection("config.version").update({ _id : 1 }, { $unset : { upgradeState : 1 } })
125
144
126
- At this point, you may retry the upgrade process by reintroducing a
127
- version 2.4 :program:`mongos` into the sharded cluster with
128
- :option:`--upgrade <mongod --upgrade>` option.
145
+ #. Retry the upgrade process, as described in :ref:`upgrade-cluster-upgrade`.
0 commit comments