MongoDB installation and Development Configuration Windows XP platform

Source: Internet
Author: User
Tags install mongodb

MongoDB is a nosql database, hoping to provide some help to users who are new to MongoDB, so as to avoid detours and serve as a reference.

1. Installation Environment Description: Windows XP SP3, MongoDB 1.8

2. Install MongoDB. Here we use mongodb1.8 as an example.

A) download mongodb1.8 from the MongoDB website. Address: http://downloads.mongodb.org/win32/mongodb-win32-i386-v1.8-latest.zip

B) decompress the downloaded compressed file. Here is D: \ mongodb_1.8 \ MongoDB, which is installed as a service. Create a directory named data and logs. The decompressed bin is also in the same directory as the logs directory. Create a text file named MongoDB. log under the logs folder. C) Start = run = CMD and run the following command:

D:\mongodb_1.8\mongodb\bin\mongod --dbpath=d:\mongodb_1.8\mongodb\data

--logpath=D:\mongodb_1.8\mongodb\logs\mongodb.log --install

In this way, the service is successfully installed. It is started when the system is started. If the machine is not restarted, You need to manually start some services (desktop = My Computer = right-click = Management =) services and applications = Services, right-click Mongo DB = Start), and the default port is 27017.

D) Set environment variables: Why do we need to set environment variables? It is convenient for us to connect mongodbwith in the command line and run it in the directory where mongo.exe is located.

My computer = "property =" Advanced = "environment variable =" system environment variable = "add to the path under" My Computer = "property =" Advanced = "environment variable =" system environment variable =:

 D:\mongodb_1.8\mongodb\bin

In this way, the environment variable is set up. (You can copy the variable value to a text file after adding the environment variable. D: \ mongodb_1.8 \ MongoDB \ bin and copy the entire string to the variable value and save it ).
Now you can experience the joy of success. Go to the command line and execute the command Mongo to display the following interface:
 
Now the MongoDB installation is complete.
3. Configure the MongoDB development environment. (Take VC ++ 2008 as an example)
A) download the C ++ driver 1.8 and boost1.4.7.0 libraries of MongoDB.
Address: https://github.com/aposto/mongodb-cxx-windows-driver.
B) decompress the package to the D: \ mongodb_1.8 directory. The local decompressed directory is:
D: \ mongodb_1.8 \ boost_mongo47_0 and D: \ mongodb_1.8 \ MongoDB-cxx-Windows-driver.
C) Compile the boost Library:
Run the Visual Studio 2008 command prompt (under "Start =" program = "Visual Studio 2008 =" Visual Studio Tools)

d:

cd D:\mongodb_1.8\boost_1_47_0

bootstrap.bat

Generate a bjam.exe executable file (this file is located at D: \ mongodb_1.8 \ boost_mongo47_0 \ bjam.exe ).
Run the following command:

bjam stage variant=debug  --stagedir="D:\mongodb_1.8\boost_1_47_0" --build-type=complete --with-filesystem --with-thread --with-date_time --with-program_options --layout=versioned threading=multi toolset=msvc-9.0

bjam stage variant=release  --stagedir="D:\mongodb_1.8\boost_1_47_0" --build-type=complete --with-filesystem --with-thread --with-date_time --with-program_options --layout=versioned threading=multi toolset=msvc-9.0

The above command compiles the debug version library, and the following command compiles the release version library. The compilation process may take some time and eventually generate a lib directory in D: \ mongodb_1.8 \ boost_mongo47_0 \ Lib, which contains the library file just generated.
Set the boost header file directory and library directory, open the menu tool-"option of VC ++ 2008, the VC ++ directory under the project and solution, and add the header file directory and library file directory.
: D) Compile MongoDB C ++ driver Driver: Use VC ++ 2008 to open mongodrv under the D: \ mongodb_1.8 \ MongoDB-cxx-Windows-driver directory. vcproj file to compile the debug and release driver libraries. Create a lib folder in D: \ mongodb_1.8 \ MongoDB-cxx-Windows-driver, create the debug and release directories under this lib directory, and run the generated two versions of mongodrv. copy lib to the corresponding directory. Set the MongoDB C ++ driver header file directory and library directory. So far, the MongoDB open environment has been established.
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.