- Install MongoDB >
- Install MongoDB Enterprise >
- Install MongoDB Enterprise on Windows
Install MongoDB Enterprise on Windows¶
New in version 2.6.
Overview¶
Use this tutorial to install MongoDB Enterprise on Windows systems. MongoDB Enterprise is available on select platforms and contains support for several features related to security and monitoring.
Prerequisites¶
MongoDB Enterprise Server for Windows requires Windows Server 2008 R2 or later. The MSI installer includes all other software dependencies.
Install MongoDB Enterprise¶
Download MongoDB Enterprise for Windows.¶
Download the latest production release of MongoDB Enterprise
Install MongoDB Enterprise for Windows.¶
Run the downloaded MSI installer. Make configuration choices as prompted.
MongoDB is self-contained and does not have any other system dependencies. You can install MongoDB into any folder (e.g. D:\test\mongodb) and run it from there. The installation wizard includes an option to select an installation directory.
Run MongoDB Enterprise¶
Warning
Do not make mongod.exe visible on public networks without running in “Secure Mode” with the auth setting. MongoDB is designed to be run in trusted environments, and the database does not enable “Secure Mode” by default.
Set up the MongoDB environment.¶
MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db. Create this folder using the following commands from a Command Prompt:
md \data\db
You can specify an alternate path for data files using the --dbpath option to mongod.exe, for example:
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
If your path includes spaces, enclose the entire path in double quotes, for example:
C:\mongodb\bin\mongod.exe --dbpath "d:\test\mongo db data"
You may also specify the dbpath in a configuration file.
Start MongoDB.¶
To start MongoDB, run mongod.exe. For example, from the Command Prompt:
C:\mongodb\bin\mongod.exe
This starts the main MongoDB database process. The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.
Depending on the security level of your system, Windows may pop up a Security Alert dialog box about blocking “some features” of C:\mongodb\bin\mongod.exe from communicating on networks. All users should select Private Networks, such as my home or work network and click Allow access. For additional information on security and MongoDB, please see the Security Documentation.
Connect to MongoDB.¶
To connect to MongoDB through the mongo.exe shell, open another Command Prompt.
C:\mongodb\bin\mongo.exe
If you want to develop applications using .NET, see the documentation of C# and MongoDB for more information.
Begin using MongoDB.¶
To begin using MongoDB, see Getting Started with MongoDB. Also consider the Production Notes document before deploying MongoDB in a production environment.
Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.
Configure a Windows Service for MongoDB Enterprise¶
You can set up the MongoDB server as a Windows Service that starts automatically at boot time.
Configure directories and files.¶
Create a configuration file and a directory path for MongoDB log output (logpath):
Create a specific directory for MongoDB log files:
md "C:\mongodb\log"
In the Command Prompt, create a configuration file for the logpath option for MongoDB:
echo logpath=C:\mongodb\log\mongo.log > "C:\mongodb\mongod.cfg"
Run the MongoDB service.¶
Run all of the following commands in Command Prompt with “Administrative Privileges:”
Install the MongoDB service. For --install to succeed, you must specify the logpath run-time option.
"C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install
Modify the path to the mongod.cfg file as needed.
To use an alternate dbpath, specify the path in the configuration file (e.g. C:\mongodb\mongod.cfg) or on the command line with the --dbpath option.
If the dbpath directory does not exist, mongod.exe will not start. The default value for dbpath is \data\db.
If needed, you can install services for multiple instances of mongod.exe or mongos.exe. Install each service with a unique --serviceName and --serviceDisplayName. Use multiple instances only when sufficient system resources exist and your system design requires it.
Stop or remove the MongoDB service as needed.¶
To stop the MongoDB service use the following command:
net stop MongoDB
To remove the MongoDB service use the following command:
"C:\mongodb\bin\mongod.exe" --remove