First steps with MongoDB. Installation and configuration of a mongo server

Resource info
Language Type
English Tutorial

is a #NoSQL, open-source and document database designed for ease of development and scaling. It uses documents instead of records, and it is recommended for systems which generate large amount of data (in Big Data scope).

MongoDB is available for all platforms and operative systems. Intallation is explained here. We are going to focus on the Windows OS installation and configuration with some “extra” features.

Installation steps:

1. Download the .msi installer (according to your Windows version) from here.
2. Choose “Custom Installation” to install mongodb in C:\mongodb folder.

Configuration steps:

1. Open a terminal and create these folders to save several mongo files

  • C:\mongodb\data (>md C:\mongodb\data)
  • C:\mongodb\db (>md C:\mongodb\db)
  • C:\mongodb\log (>md C:\mongodb\log)

2. Create a configuration file (mongo.config) in the root folder with this information:

bind_ip = 127.0.0.1
port = 27017
quiet=true
dbpath=C:\mongodb\data\db
logpath=C:\mongodb\data\log\mongodb.log
logappend=true

(Create “\db” and “\log” folders in “mongodb\data” if was necessary)

3. Start and test mongodb (>C:\mongodb\bin\mongod.exe --config="C:\mongodb\mongo.config")

4. Connect to mongo. Open a new terminal as administrator and execute mongo command (>C:\mongodb\bin\mongo.exe)

Install MongoDB as a windows service:

1. Run command >sc create MongoDB binpath="\ "C:\mongodb\bin\mongod.exe" --service --config=\"C:\mongodb\mongo.config"" DisplayName="Mongo Standard"

If services was successfully created, the following log message appears at the prompt (>[SC] CreateService SUCCESS)

Also, you can start and stop the service from the command line with these commands:

  • >net start MongoDB
  • >net stop MongoDB

To remove MongoDB service, run the command >sc delete MongoDB.

Share Button
This entry was posted in Tutorials and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter de captcha * Time limit is exhausted. Please reload the CAPTCHA.