- Install MongoDB >
- Install MongoDB Enterprise >
- Install MongoDB Enterprise on Windows
Install MongoDB Enterprise on Windows¶
On this page
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 and will
automatically upgrade any older version of MongoDB installed using an .msi
file.
Get MongoDB Enterprise¶
To get the binaries for MongoDB 2.6 Enterprise (which has reached end of life on October 2016), you can download from https://www.mongodb.com/download-center/enterprise/releases/archive.
Install MongoDB Enterprise¶
Interactive Installation¶
Install MongoDB Enterprise for Windows.¶
In Windows Explorer, locate the downloaded MongoDB .msi
file, which
typically is located in the default Downloads
folder. Double-click
the .msi
file. A set of screens will appear to guide you through the
installation process.
You may specify an installation directory if you choose the “Custom” installation option.
Note
These instructions assume that you have installed MongoDB
to C:\mongodb
.
MongoDB is self-contained and does not have any other system
dependencies. You can run MongoDB from any folder you choose. You may
install MongoDB in any folder (e.g. D:\test\mongodb
).
Unattended Installation¶
You may install MongoDB unattended on Windows from the command line
using msiexec.exe
.
Install MongoDB Enterprise for Windows.¶
Open a shell in the directory containing the .msi
installation
binary of your choice and invoke:
By default, this method installs the following MongoDB binaries:
mongod.exe
, mongo.exe
, mongodump.exe
,
mongorestore.exe
, mongoimport.exe
, mongoexport.exe
,
mongostat.exe
, and mongotop.exe
.
You can specify the installation location for the executable by
modifying the <installation directory>
value. To install specific
subsets of the binaries, you may specify an ADDLOCAL
argument:
The <binary set(s)>
value is a comma-separated list including one
or more of the following:
Server
- includesmongod.exe
Client
- includesmongo.exe
MonitoringTools
- includesmongostat.exe
andmongotop.exe
ImportExportTools
- includesmongodump.exe
,mongorestore.exe
,mongoexport.exe
, andmongoimport.exe
)MiscellaneousTools
- includesbsondump.exe
,mongofiles.exe
,mongooplog.exe
, andmongoperf.exe
For instance, to install only the entire set of tools to
C:\mongodb
, invoke:
You may also specify ADDLOCAL=ALL
to install the complete set of
binaries, as in the following:
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:
You can specify an alternate path for data files using the
--dbpath
option to
mongod.exe
, for example:
If your path includes spaces, enclose the entire path in double quotes, for example:
You may also specify the dbpath
in a configuration file.
Start MongoDB.¶
To start MongoDB, run mongod.exe
. For example, from the
Command Prompt:
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 ~bin.mongo.exe
shell,
open another Command Prompt.
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¶
Create directories.¶
Create directories for your database and log files:
Create a configuration file.¶
Create a configuration file. The file must set systemLog.path
.
Include additional
configuration options as appropriate.
For example, create a file at C:\mongodb\mongod.cfg
that specifies both
systemLog.path
and storage.dbPath
:
Install the MongoDB service.¶
Important
Run all of the following commands in Command Prompt with “Administrative Privileges”.
Install the MongoDB service by starting mongod.exe
with the --install
option and the -config
option to specify the previously created configuration file.
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 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.
Start the MongoDB service.¶
Stop or remove the MongoDB service as needed.¶
To stop the MongoDB service use the following command:
To remove the MongoDB service use the following command:
Manually Create a Windows Service for MongoDB Enterprise¶
You can set up the MongoDB server as a Windows Service that starts automatically at boot time.
The following procedure assumes you have installed MongoDB using the
.msi
installer with the path C:\mongodb\
.
If you have installed in an alternative directory, you will need to adjust the paths as appropriate.
Create directories.¶
Create directories for your database and log files:
Create a configuration file.¶
Create a configuration file. The file must set systemLog.path
.
Include additional
configuration options as appropriate.
For example, create a file at C:\mongodb\mongod.cfg
that specifies both
systemLog.path
and storage.dbPath
:
Create the MongoDB service.¶
Create the MongoDB service.
sc.exe
requires a space between “=” and the configuration values
(eg “binPath= “), and a “" to escape double quotes.
If successfully created, the following log message will display:
Start the MongoDB service.¶
Stop or remove the MongoDB service as needed.¶
To stop the MongoDB service, use the following command:
To remove the MongoDB service, first stop the service and then run the following command: