On this page
Change Standalone to WiredTiger
Starting 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
mongodump
and mongorestore
This tutorial uses the mongodump
and mongorestore
utilities to export and import data.
Default Bind to Localhost
Starting with MongoDB 3.6, MongoDB binaries, mongod
and mongos
, bind to localhost
by default. From MongoDB versions 2.6 to 3.4, only the binaries from the official MongoDB RPM (Red Hat, CentOS, Fedora Linux, and derivatives) and DEB (Debian, Ubuntu, and derivatives) packages would bind to localhost
by default. To learn more about this change, 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
.
MongoDB 3.0 or Greater
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.
XFS and WiredTiger
With the WiredTiger storage engine, using XFS for data bearing nodes is recommended on Linux. For more information, see Kernel and File Systems.
Procedure
Start the mongod
you wish to change to WiredTiger.
If mongod
is already running, you can skip this step.
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.
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 binding to a non-localhost (e.g. publicly accessible) IP address, ensure you have secured 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,<ipaddresses>
You can also specify the options in a configuration file. To specify the storage engine, use the storage.engine
setting.
Upload the exported data using mongorestore
.
mongorestore <exportDataDestination>
Specify additional options as appropriate. See mongorestore
for available options.