OPTIONS

Change Config Servers to WiredTiger

New in version 3.0: The WiredTiger storage engine is available.

Changed in version 3.2: WiredTiger is the new default storage engine for MongoDB.

This tutorial gives an overview of changing the storage engine of the config servers in a sharded cluster to WiredTiger.

Considerations

You may safely continue to use MMAPv1 for the config servers even if the shards of the sharded cluster is using the WiredTiger storage engine. If you do choose to update the config servers to use WiredTiger, you must update all three.

You must be using MongoDB version 3.0 or greater in order to use the WiredTiger storage engine. If upgrading from an earlier version of MongoDB, see the guides on Upgrading to MongoDB 3.0 or Upgrading to MongoDB 3.2 before proceeding with changing your storage engine.

Procedure

This tutorial assumes that you have three config servers for this sharded cluster. The three servers are named first, second, and third, based on their position in the mongos configDB setting.

Note

During this process, only two config servers will be running at any given time to ensure that the sharded cluster’s metadata is read-only.

1

Disable the balancer.

sh.disableBalancer()

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

2

Shut down the third config server.

Use the mongo shell to shut down the third config server.

The third config server is the last one listed in the mongos configDB setting.

3

Export the data of the second config server with mongodump.

The second config server is the second server listed in the mongos setting configDB.

mongodump --out <exportDataDestination>

Specify additional options as appropriate, such as username and password if running with authorization enabled. See mongodump for available options.

4

For the second config server, create a data directory for the new mongod running with WiredTiger.

Create a data directory for the new mongod instance that will run with the WiredTiger storage engine. mongod must have read and write permissions for this directory.

mongod with WiredTiger will not start with data files created with a different storage engine.

5

Start the second config server mongod with WiredTiger.

Start mongod as a config server, specifying wiredTiger as the --storageEngine and the newly created data directory for WiredTiger as the --dbpath. Specify additional options as appropriate.

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

You can also specify the options in a configuration file. To specify the storage engine, use the storage.engine setting.

6

Upload the exported data using mongorestore to the second config server.

mongorestore <exportDataDestination>

Specify additional options as appropriate. See mongorestore for available options.

7

Shut down the second config server.

When the mongorestore procedure of the previous step is complete, use the mongo shell to shut down the second config server. This is necessary to maintain only two active config servers at once and keep the sharded cluster’s metadata read-only.

db.shutdownServer()
8

Restart the third config server.

Simply restart the third config server with its original startup options. Do not change it to use the WiredTiger storage engine yet, as that will be done in a later step.

mongod --configsvr
9

Export the data of the third config server with mongodump.

mongodump --out <exportDataDestination>

Specify additional options as appropriate, such as username and password if running with authorization enabled. See mongodump for available options.

10

For the third config server, create a data directory for the new mongod running with WiredTiger.

Create a data directory for the new mongod instance that will run with the WiredTiger storage engine. mongod must have read and write permissions for this directory.

mongod with WiredTiger will not start with data files created with a different storage engine.

11

Start the third config server with WiredTiger.

Start mongod as a config server, specifying wiredTiger as the --storageEngine and the newly created data directory for WiredTiger as the --dbpath. Specify additional options as appropriate.

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

You can also specify the options in a configuration file. To specify the storage engine, use the storage.engine setting.

12

Upload the exported data using mongorestore to the third config server.

mongorestore <exportDataDestination>

Specify additional options as appropriate. See mongorestore for available options

13

Export data of the first config server with mongodump.

mongodump --out <exportDataDestination>

Specify additional options as appropriate, such as username and password if running with authorization enabled. See mongodump for available options.

14

For the first config server, create a data directory for the new mongod running with WiredTiger.

Create a data directory for the new mongod instance that will run with the WiredTiger storage engine. mongod must have read and write permissions for this directory.

mongod with WiredTiger will not start with data files created with a different storage engine.

15

Start the first config server with WiredTiger.

Start mongod as a config server, specifying wiredTiger as the --storageEngine and the newly created data directory for WiredTiger as the --dbpath. Specify additional options as appropriate.

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

You can also specify the options in a configuration file. To specify the storage engine, use the storage.engine setting.

16

Upload the exported data using mongorestore to the first config server.

mongorestore <exportDataDestination>

Specify additional options as appropriate. See mongorestore for available options

17

Enable writes to the sharded cluster’s metadata.

Restart the second config server with the same options as in step 5. Remember to specify WiredTiger as the --storageEngine and the newly created WiredTiger data directory as the --dbpath.

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

You can also specify the options in a configuration file. To specify the storage engine, use the storage.engine setting.

Once all three config servers are up, the sharded cluster’s metadata is available for writes.

18

Re-enable the balancer.

Once all three config servers are up and running with WiredTiger, re-enable the balancer.

sh.startBalancer()

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.