Docs Menu
Docs Home
/
MongoDB Manual
/ / /

Change Standalone to WiredTiger

Note

Starting in version 4.2, MongoDB removes the deprecated MMAPv1 storage engine. If upgrading to MongoDB 4.2 from a MongoDB 4.0 deployment that uses MMAPv1, you must upgrade to WiredTiger.

Use this tutorial to change the storage engine of a standalone MongoDB instance to WiredTiger.

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.

  • 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.

MongoDB binaries, mongod and mongos, bind to localhost by default.

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 using an earlier MongoDB version, you must upgrade your MongoDB version before proceeding to change your storage engine. To upgrade your MongoDB version, refer to the appropriate version of the manual.

With the WiredTiger storage engine, using XFS for data bearing nodes is recommended on Linux. For more information, see Kernel and File Systems.

Once upgraded to WiredTiger, your WiredTiger deployment is not subject to the following MMAPv1-only restrictions:

MMAPv1 Restrictions
Short Description
Number of Namespaces
For MMAPv1, the number of namespaces is limited to the size of the namespace file divided by 628.
Size of Namespace File
For MMAPv1, namespace files can be no larger than 2047 megabytes.
Database Size
The MMAPv1 storage engine limits each database to no more than 16000 data files.
Data Size
For MMAPv1, a single mongod instance cannot manage a data set that exceeds maximum virtual memory address space provided by the underlying operating system.
Number of Collections in a Database
For the MMAPv1 storage engine, the maximum number of collections in a database is a function of the size of the namespace file and the number of indexes of collections in the database.
1

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

2
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 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

Remove any MMAPv1 Specific Configuration Options from the mongod instance configuration.

5

Start mongod, specifying wiredTiger as the --storageEngine and the newly created data directory for WiredTiger as the --dbpath.

Specify additional options as appropriate, such as --bind_ip.

Warning

Before you bind your instance to a publicly-accessible IP address, you must secure your cluster from unauthorized access. For a complete list of security recommendations, see Security Checklist. At minimum, consider enabling authentication and hardening network infrastructure.

mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath> --bind_ip localhost,<hostname(s)|ip address(es)>

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

6
mongorestore <exportDataDestination>

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

Back

WiredTiger Storage Engine