Specify this to install MongoDB as a Windows Service. Getting started with administrative shell To start an administrative shell, enter bin directory of your MongoDB installation and execute mongo.exe file. MongoDB x64 - X 64-bit Download - x64-bit download - freeware, shareware and software downloads. MongoDB Tutorial - Installing Mongo on Windows 10 Code With Intent. How to reset Wi-Fi or Ethernet network adapter on Windows 10 to fix any. How to Install MongoDB 3.4 on Windows 10 and use.
This post will provide the full path from downloading required binary archive/package for particular Windows version to starting up MongoDB in various ways
We will go through following high level steps-
- Download the MongoDB binary archive for windows platform
- Extract MongoDB archive
- Setup up configuration parameters and start/stop MongoDB
- using command line
- using windows services
For Windows platform, MongoDB distributes zip archive. Go to following downloads page from browser http://www.mongodb.org/downloads
Depends on system architecture, it comes in two distribution as
- 32-bit
- 64-bit
Downloading the 64-bit is recommended. Again, MongoDB distribution for Windows 64-bit ships with two flavors
- one for Newer OS, Windows server 2008 and Windows 7, Server 2012 (download link Big Green button)
- other for Older OS, Windows Server 2003,2008 and Vista (Download link, 64-bit legacy )
This distinction for x64 is made based on newer OS features which helps in enhanced performance of MongoDB.
After you download, you will get zip archive in follwing format-
mongodb—.zip
Once we have MongoDB archive, go ahead and extract archive using any zip extract program.
After extracting, you will get the directories inside archive as follows
here , bin directory contains the binaries in form of executables , such as mongod.exe, mongo.exe, monogexport.exe etc.
For starting and stopping the MongoDB server, we need only the bin/mongod.exe, which is the daemon process executable for MongoDB. In short, it is the executable which starts up the MongoDB Server.
For starting up, we need to provide the parameters for executable, which i call it here as config parameters or params.
We can setup the config parameters using the two ways
- Using command line options or
- Using config file
Using command line options
With use of these command line options, we configure mongo daemon process. Basically, there lots of options we can specify but i will give only those which required for this tutorial.
Following are someof them-
–dbpath : the existent directory path, which is required to store data files. this is most important option we need to specify, Note that, the directory path you are providing should exists otherwise process won’t start. If this path contains spaces then put all its path in double qoutes. e.g. –dbpath “c:Program Files”
–logpath : the existent file path, used by mongo daemon process,for flush out loggs instead of in standard console. If this path contains spaces then put all its path in double qoutes
–port : port no. where mongod process listen for connection from client, it defaults to 27017 if not specified
Note : While using the command prompt on some Windows OS like windows 7 or Windows server 2008, Run it with administrator privileges as shown as follows
Use the following commands to start the server process
Change to bin directory
now type following command to start the mongod process
While starting, Windows firewall may block the process as shown as follows
Click “Allow access“ to proceed. After successful execution of command , it will show logging info in standard console itself as shown follows
If you specify the logpath option, then logging will direct to that log file instead of showing up on standard console
and prompt will wait there and you can find all the logs at specified log file location You can stop this process with use of keys Ctrl+C or Ctrl +D from keyboard
Using the config file
Instead of specifying command line option, we can specify same with use of file, which i call it here as config file Config file is just text file, containing the parameters in the key=value form and each one is specified on the every line of file In this, we basically provide path to file (which contains the configurations) as command line option as “-f” or “–config” Following is the snippet for the config file
You can save this file with any extension, but specify full path with extension, while stating process as shown in following commands. From command prompt, you will use either of following
Support for installing MongoDB as Windows service comes out of the box.
MongoDB daemon executable provides amazing support for the installation of services using few command line parameters without using additional components for this purpose Just we need set the few command line params and we are way to go.
Following are required parameters
–install : command line switch to install the service
–remove : command line switch to remove the service
–serviceName : the name for mongod windows service and must adhere to naming services in windows like only accepting the alphanumeric chars with no spaces
–serviceDisplayName : Display name for service that is shown in services console, put this in double quotes if contains the spaces
–serviceDescription : Small description about service, put this in double quotes if contains the spaces
![Free Free](http://filewells.com/wp-content/uploads/2017/01/firefox-download-1024x783.jpg)
While installing as service we must provide log file path as counterpart to starting it from command line, because while starting service we don’t as standard console
I will be using the config file for some configurations
In log path specified, you can check for the whether windows services started or not
Above will install the mongodb as Windows service, check Services console using services.msc
Now we can start or stop MongoDB using Windows services console as shown above.
For removing installed service use following
Today we will learn how to install MongoDB on Windows. Most of us use Windows for our personal use. That’s why I am writing this tutorial to help you install MongoDB on Windows. We will also learn how to start and uninstall MongoDB on Windows.
Table of Contents
- 1 Install MongoDB on Windows
MongoDB for Windows
Starting from MongoDB version 2.2, MongoDB doesn’t support Windows XP. So if you are on Windows XP, either upgrade it or use the lower versions of MongoDB. This tutorial is intended to help you in installing MongoDB on Windows latest versions i.e Windows 7 and Windows 8, 8.1 etc.
Install MongoDB on Windows
Follow below steps to perform the installation of MongoDB into your windows system.
- Consider specific MongoDB build type which you need actually
Three build types of MongoDB for Windows are available.
- MongoDB for Windows Server 2008 R2 series: This build type runs only on 2008R2, Windows 7 64-bit, Windows 8, and latest versions of Windows.
- MongoDB for Windows 64-bit: This build type of MongoDB runs on any 64-bit version of Windows latest than Windows XP, involve Windows Server 2008 R2 and Windows 7 64-bit.
- MongoDB for Windows 32-bit: MongoDB runs on any 32-bit version of Windows latest than Windows XP, 32-bit version of MongoDB are only designed for older system and use for testing and developing systems. Windows 32-bit versions of MongoDB support only database smaller than 2GB.
If you want to know that which specific version of windows you are running at your system, then simply use following command on command prompt.
- Download MongoDB for Windows
Download the latest version release from the MongoDB Download page. Make sure you download the latest version of MongoDB for your Windows. Note that 64-bit versions of MongoDB do not run with 32-bit Windows.
- MongoDB Installation Options
In Windows Explorer, simply locate downloaded MongoDB msi file, then Double-click the msi file. A series of screens will guide you through the installation procedure. There are multiple options such as Typical, Custom and Complete installation. MongoDB default installation goes into Program Files, so if you want to change it then go for Custom installation.
- MongoDB installation folder move to another location (Optional)
Sometimes we want to move the installation to another directory, we can use move command for this. This command needs to be run as administrator. For example, to move the folder to C:MongoDB follow the steps shown in below images.
MongoDB does not depend at any other system because it is self contained. You can execute MongoDB from the folder of your choice and can install it in any folder (for, example D:testmongodb)
Running MongoDB Server
We need to create a directory where MongoDB server will store all it’s data. The MongoDB default data directory path is datadb. Make this folder using the following commands from Command Prompt. Note that if the directory doesn’t exists, MongoDB will try to create it. But it’s good to create it before hand.
To start MongoDB server, we need to run mongod.exe. For example, from the Command Prompt;
This MongoDB starts the main databases process. The waiting for connection message in the console results determines that the mongod.exe process is complete.
You can use a different path for data files using the –dbpath option to mongod.exe, for example:
If your path contains white spaces, then you need to use double quotes as shown below.
The security level depends on your system configurations, Windows provide pop up a Security Alert dialog box about blocking few features of C:Folder NameMongoDBbinmongod.exe
from communication on networks.
All the clients should choose Private Networks. For example, my home or work network and click Allow access. For more information on security and MongoDB, please look into the Security Documentation.
Connecting to MongoDB server through Command Prompt
We can connect to MongoDB server through mongo.exe client application, just open another command prompt and execute it.
That’s it, once connected we can issue any MongoDB shell commands. To close the client connection, just fire “exit” command or simply close the command prompt.
MongoDB as Windows Service
The problem with above installation is that we need to start MongoDB server manually and then keep the command prompt open. The solution is to configure it as Windows service, so that it can start as soon as system is up and running. Since it will be running in background, there is no need to keep command prompt open.
Mongodb Download Center
Before we configure our MongoDB installation as Windows service, let’s create a configuration file for the MongoDB logs.
Now using echo command we can create a configuration file. If you get any permission issues, then run the command prompt as administrator.
Now run below command as administrator to setup MongoDB as service.
If you want to change MongoDB server port or any other configurations, then you can provide them in the above configuration file.
If you want to install services for multiple example of mongod.exe, install every service with a unique –serviceName and –serviceDisplayName. Use the multiple examples only when sufficient system resources exist and your design requires it.
Download Mongodb For Windows 10 64 Bit Zip
Uninstall MongoDB Windows
If you want to remove the MongoDB service, then run below command as administrator.
That’s all for installing MongoDB on Windows and running it as Windows service. We will look into different MongoDB commands in coming posts.