发布于 2015-09-14 15:08:49 | 125 次阅读 | 评论: 0 | 来源: 网络整理

Only upgrade sharded clusters to 2.4 if all members of the cluster are currently running instances of 2.2. The only supported upgrade path for sharded clusters running 2.0 is via 2.2.

Rolling Upgrade Limitation for 2.2.0 Deployments Running with auth Enabled

MongoDB cannot support deployments that mix 2.2.0 and 2.4.0, or greater, components. MongoDB version 2.2.1 and later processes can exist in mixed deployments with 2.4-series processes. Therefore you cannot perform a rolling upgrade from MongoDB 2.2.0 to MongoDB 2.4.0. To upgrade a cluster with 2.2.0 components, use one of the following procedures.

  1. Perform a rolling upgrade of all 2.2.0 processes to the latest 2.2-series release (e.g. 2.2.3) so that there are no processes in the deployment that predate 2.2.1. When there are no 2.2.0 processes in the deployment, perform a rolling upgrade to 2.4.0.
  2. Stop all processes in the cluster. Upgrade all processes to a 2.4-series release of MongoDB, and start all processes at the same 2.time.

Upgrade a Sharded Cluster from MongoDB 2.2 to MongoDB 2.4

Upgrading a sharded cluster from MongoDB version 2.2 to 2.4 (or 2.3) requires that you run a 2.4 mongos with the --upgrade option, described in this procedure. The upgrade process does not require downtime.

The upgrade to MongoDB 2.4 adds epochs to the metadata for all collections and chunks in the existing cluster. MongoDB 2.2 processes are capable of handling epochs, even though 2.2 did not require them.

This procedure applies only to upgrades from version 2.2. Earlier versions of MongoDB do not correctly handle epochs.

While the upgrade is in progress, you cannot make changes to the collection metadata. For example, you cannot perform operations that add shards, drop databases, or drop collections, or modify the metadata in any other way.

警告

Once you upgrade to 2.4 and complete the upgrade procedure do not use 2.0 mongod and mongos processes in your cluster. 2.0 process may re-introduce old metadata formats into cluster metadata.

Sharded Cluster Upgrade Procedure

Do not perform operations that modify metadata while performing this procedure.

  1. Turn off the balancer in the sharded cluster, as described in Disable the Balancer.

  2. Ensure there are no version 2.0 mongod or mongos processes still active in the sharded cluster. The automated upgrade process checks for 2.0 processes, but network availability can prevent a definitive check. Wait 5 minutes after stopping or upgrading version 2.0 mongos processes to confirm that none are still active.

  3. Start a single 2.4 mongos process with configdb pointing to the sharded cluster’s config servers and with the --upgrade option. You can upgrade an existing mongos instance to 2.4 or you can start a new mongos instance that can reach all config servers if you need to avoid reconfiguring a production mongos.

    Start the mongos with a command that resembles the following:

    mongos --configdb <config server> --upgrade
    

    Without the --upgrade option 2.4 mongos processes will fail to start until the upgrade process is complete.

    The upgrade will prevent any chunk moves or splits from occurring during the upgrade process. If there are very many sharded collections, acquiring the locks for all collections may take seconds or minutes. See the log for progress updates.

  4. When the mongos process starts successfully, the upgrade is complete. If the mongos process fails to start, check the log for more information.

    If a network interruption occurred and prevented changes, see Resync after a Network Interruption.

  5. Re-enable the balancer. You can now perform operations that modify cluster metadata.

  6. Upgrade and restart other mongos processes in the sharded cluster, without the --upgrade option.

Once you have upgraded, do not introduce version 2.0 MongoDB processes into the sharded cluster. This can reintroduce old metadata formats into the config servers. The metadata change made by this upgrade process will help prevent errors caused by cross-version incompatibilities in future versions of MongoDB.

Resync after a Network Interruption

During the short critical section of the upgrade that applies changes to the metadata, it is unlikely but possible that a network interruption can prevent all three config servers from verifying or modifying data. If this occurs, the config servers must be re-synced, and there may be problems starting new mongos processes. The sharded cluster will remain accessible, but avoid all cluster metadata changes until you resync the config servers. Operations that change metadata include: adding shards, dropping databases, and dropping collections.

To resync the config servers:

  1. Turn off the balancer in the sharded cluster and stop all metadata operations. If you are in the middle of an upgrade process (Upgrade a Sharded Cluster from MongoDB 2.2 to MongoDB 2.4), you have already disabled the balancer. .

  2. Shut down two of the three config servers, preferably the last two listed in the configdb string. For example, if your configdb string is configA:27019,configB:27019,configC:27019, shut down configB and configC. Shutting down the last two config servers ensures that most mongos instances will have uninterrupted access to cluster metadata.

  3. mongodump the data files of the active config server (configA).

  4. Move the data files of the deactivated config servers (configB and configC) to a backup location.

  5. Create new, empty data directories.

  6. Restart the disabled config servers with --dbpath pointing to the now-empty data directory and --port pointing to an alternate port (e.g. 27020).

  7. Use mongorestore to repopulate the data files on the disabled documents from the active config server (configA) to the restarted config servers on the new port (configB:27020,configC:27020). These config servers are now re-synced.

  8. Restart the restored config servers on the old port, resetting the port back to the old settings (configB:27019 and configC:27019).

  9. In some cases connection pooling may cause spurious failures, as the mongos disables old connections only after attempted use. 2.4 fixes this problem, but to avoid this issue in version 2.2, you can restart all mongos instances (one-by-one, to avoid downtime) and use the rs.stepDown() method before restarting each of the shard replica setprimaries.

  10. The sharded cluster is now fully resynced; however before you attempt the upgrade process again, you must manually reset the upgrade state using a version 2.2 mongos. Begin by connecting to the 2.2 mongos with the mongo shell:

    mongo <2.2 mongos port>
    

    Then, use the following operation to reset the upgrade process:

    db.getMongo().getCollection("config.version").update({ _id : 1 }, { $unset : { upgradeState : 1 } })
    
  11. Finally retry the upgrade process, as in Upgrade a Sharded Cluster from MongoDB 2.2 to MongoDB 2.4.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务