Mongodb – how to upgrade the config servers to use WiredTiger in mongodb 3.0.0

mongodb

I am reading the document upgrade config servers to use WiredTiger. In the section of "change config server to use WiredTiger", the second step is "stop the last config server listed in the mongos' configDB setting". But the 5th step is to restart the second config server with WiredTiger. I am confused by the sequence of stopping and restarting. Is there problem on this document?

Another question, why the data in config servers should be exported and uploaded manually? Why the data in replicate set should not be exported and uploaded manually? Instead, the data in replicate set can be imported by "Resync a Member of a Replica Set" please see official doc

Best Answer

The current wording in the documented steps may be somewhat confusing given the relative references to first/last/second config servers.

I've added some context for the documented steps below, but you should consider the manual the definitive source. It's also worth noting that you do not have to upgrade the config servers to use WiredTiger (even if your shards are using WiredTiger). Config servers typically have a small data set and are not under high write load.

Annotated version of the steps from the MongoDB 3.0 Upgrade Guide

  1. Disable the balancer.

    Disabling the balancer ensures any active migrations have completed.

  2. Stop the last config server listed in your mongos' configDB setting (will call that config3 for the purpose of these steps):

    At this stage you should have:

    • config1 (running mmap)
    • config2 (running mmap)
    • config3 (stopped)

    Stopping one of the config servers ensures there are no changes to the metadata in the cluster (chunk splits or migrations cannot be committed without all three config servers available).

  3. Use mongodump to export the config database from config2

    After running the mongodump you should have a dump directory with bson files.

  4. Create a new data directory on config2.

    The storage format for WiredTiger data is different from the existing mmap data, and cannot use the same dbpath as mmap.

  5. Restart the config2 server with the WiredTiger and appropriate storage options:

    mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath> ...

    At this stage you should have:

    • config1 (running mmap)
    • config2 (running WiredTiger with no data)
    • config3 (stopped)

    Note that config2 doesn't have any data yet, because it has just been started up with the new WiredTiger dbpath.

  6. Use mongorestore to load the config database backup you created in step 3.

    At this stage you should have:

    • config1 (running mmap)
    • config2 (running WiredTiger)
    • config3 (stopped)
  7. Shut down config2:

    At this stage you should have:

    • config1 (running mmap)
    • config2 (stopped)
    • config3 (stopped)

    config2 is stopped at this point to ensure no metadata changes can happen when we start config3 up in the next step.

  8. Restart config3.

    At this stage you should have:

    • config1 (running mmap)
    • config2 (stopped)
    • config3 (running mmap)

(steps 9-15) These steps are just repeating the same mongodump and mongorestore for each config server. There's a bit of shuffling to ensure you always have at least one config server available, and do not have all three up while you are still migrating data.

  1. Upload the data into config1

    At this stage you should have:

    • config1 (running WiredTiger)
    • config2 (stopped)
    • config3 (running WiredTiger)
  2. Start config2

    With all three config servers are available & upgraded, changes to the sharded cluster metadata can now resume.

  3. Re-enable the balancer so normal balancing activity & chunk migration can resume.