Navigation

Change Standalone 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 a standalone MongoDB instance to WiredTiger.

Considerations

This tutorial uses the mongodump and mongorestore utilities to export and import data. Ensure that these MongoDB package components are installed and updated on your system. In addition, make sure you have sufficient drive space available for the mongodump export file and the data files of your new mongod instance running with WiredTiger.

Note

Starting in MongoDB 3.6, MongoDB binaries, mongod and mongos, bind to localhost by default. Previously, starting in MongoDB 2.6, only the binaries from the official MongoDB RPM (Red Hat, CentOS, Fedora Linux, and derivatives) and DEB (Debian, Ubuntu, and derivatives) packages bind to localhost by default. For more details, see Localhost Binding Compatibility Changes.

The tutorial runs mongodump and mongorestore from the same host as the mongod they are connecting to. If run remotely, mongodump and mongorestore must specify the ip address or the associated hostname in order to connect to the mongod.

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

1

Start the mongod you wish to change to WiredTiger.

If mongod is already running, you can skip this step.

2

Export data using mongodump.

mongodump --out <exportDataDestination>

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

3

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.

4

Start mongod with WiredTiger.

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

Warning

Before you bind to other ip addresses, consider enabling access control and other security measures listed in Security Checklist to prevent unauthorized access.

mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath> --bind_ip localhost,<ipaddresses>

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

5

Upload the exported data using mongorestore.

mongorestore <exportDataDestination>

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