MongoDB Download and Installation

Source: Internet
Author: User
Tags mongodb download mongodb version

First, download

MongoDB's official website is: http://www.mongodb.org/

The latest version of MongoDB is downloaded under the Download menu on the official website: http://www.mongodb.org/downloads

I chose Windows 32-bit 1.8. Version 1

MongoDB for. NET Driver Development Kit is located on the official website of the driver menu (including other language development links): Https://github.com/mongodb/mongo-csharp-driver/downloads

My operating system is WINDOWS7 Professional Edition, choose MongoDB version for Windows 32-bit 1.8.1, development package for VS2008 version

Let's start our installation process.

Second, installation

1. Unzip the Mongodb-win32-i386-1.8.1.zip, create the path C:\Program Files\mongodb, and copy the extracted bin file to this folder

2.c:\program Files\mongodb set up the Data folder C:\Program Files\mongodb\data, and then set up a Db,log two folders, at this point MongoDB has the following folder

C:\Program Files\mongodb\bin

C:\Program files\mongodb\data\db

C:\Program Files\mongodb\data\log

Create a log file under the log folder MongoDB.log, which is C:\Program Files\mongodb\data\log\mongodb.log

After completing the above work, you are wondering why to create these folders (because the MongoDB installation requires these folders, the default installation is not created, but the files are installed to C:\data\)

3. Introduction of several installation methods

3.1 Program Start mode

Run Cmd.exe into DOS hit interface

> CD C:\Program files\mongodb\bin

> C:\Program files\mongodb\bin>mongod-dbpath "C:\Program files\mongodb\data\db"

Execute this command to create a database file of MongoDB to the C:\Program files\mongodb\data\db directory, and not unexpectedly see a successful prompt sucess the last line of the command

At this point the database has been started, the interface is MONGO startup program, closed after you can directly double-click on the bin Mongod.exe (Note is D, this is the startup program)

After the startup program is turned on, run the Mongo.exe program (note that there is no d), the interface is as follows

Test database Operations

>help (View related information)

>db.foo.insert ({a:1}) (Insert a,1 field value to Foo table, Foo table as default table)

>db.foo.find () (View foo table data)

The results are as follows:

You can see that 3 records were inserted a,cctv,set.

When the Mongod.exe is closed, Mongo.exe will not be able to connect to the database, so every time you want to use the MongoDB database to open the Mongod.exe program, it is more troublesome, next we will

MongoDB installed as a Windows service bar

3.2 Windows Service mode

Run Cmd.exe

> CD C:\Program files\mongodb\bin

> C:\Program files\mongodb\bin>mongod--dbpath "C:\Program files\mongodb\data\db"--logpath "C:\Program files\ Mongodb\data\log\mongodb.log "--install--servicename" MongoDB "

Here MongoDB.log is the log file that was started,--servicename the "MongoDB" service named MongoDB

Run the command successfully for such as:

The time service has been installed successfully, running

>net Start MongoDB (open service)

>net Stop MongoDB (shutdown service)

>

> C:\Program files\mongodb\bin>mongod--dbpath "C:\Program files\mongodb\data\db"--logpath "C:\Program files\ Mongodb\data\log\mongodb.log "--remove--servicename" MongoDB "(delete, note not--install)

Other commands can be found on the help command or official website.

View Services

Run the Bin folder under the Mongo.exe client to test it. The test is the same as 3.1.

3.3 Daemon Mode creation

--fork running MongoDB as daemon, creating a server process

>c:\program files\mongodb\bin>mongod--port 10220--fork--dbpath "C:\Program files\mongodb\data\db"--logpath "C : \program Files\mongodb\data\log\mongodb.log "

Forked process:44086

All output Going To:MongoDB.log

The introduction of these several installations is completed.

4. Stop MongoDB

The most secure way to stop all current operations and save cached data to disk

>user Admin

>db.shutdownserver ();

Of course, we can also close the process directly, but this will cause the data in the cache to be saved to disk without urgency and lost. The next chapter is MONGO for. NET developed

MongoDB Download and Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.