MongoDB is an open source document database that provides high performance, high availability, and auto-scaling. MongoDB is written by the C + + language.
Document Database (Documentdatabase):
A record is called a document in MongoDB, which is a data structure component of a pair of column values. MongoDB documents are similar to JSON objects (oh, I don't know yet). Column values may include other documents, arrays, or arrays in the document.
more bit and feature reference Introductionto MongoDB:http://docs.mongodb.org/manual/core/introduction
Current version: mongodb-win32-i386-2.6.5
:https://www.mongodb.org/downloads
Document Center:http://docs.mongodb.org/manual
Install MongoDB on Windows:http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows
the installation of MongoDB is simple.
Unzip the mongodb-win32-i386-2.6.5 to D and change the name:
D:\mongodb
The MONGODB directory structure is also simple:
To create a directory where the database and error logs are stored:
mkdir D:\MongoDB\data\db
mkdir D:\MongoDB\data\log
Develop the data directory and error log directory to start the MongoDB service and enable journal (equivalent to the transaction log file, which is closed by default):
D:\mongodb\bin>mongod.exe--dbpath=d:\mongodb\data\db--directoryperdb--logpath=d:\mongodb\data\log\ Mongodb.log--logappend--journal
Database directory structure:
Journal: transaction log directory (j._0 log file numbered from 0, recyclable)
mongod.lock : Record the process number of the current Mongod
_tmp: Temporary data file
local.0 : Database file, increment by ordinal, size also multiply (64m-128m-256m-512m-1g-max 2G)
local.ns: Record collection namespaces and Index namespaces
Client-server database connection is connected via TCP/IP socket, the default port is 27017
Connect to MongoDB:
Open a new command-line window: D:\mongodb\bin>mongo.exe
Now change to set the service as the startup of the Windows service:
Create a configuration file (easy to modify parameters):
echo logpath= d:\mongodb\data\log\mongodb.log> "D:\mongodb\mongod.cfg"
echo dbpath= d:\mongodb\data\db>> "D:\mongodb\mongod.cfg"
echo port = 27017>> "D:\mongodb\mongod.cfg"
echo logappend = true>> "D:\mongodb\mongod.cfg"
echo Journal = true>> "D:\mongodb\mongod.cfg"
To create a Windows service:
# Sc.exe Delete MongoDB
Sc.exe create MongoDB binpath= "\" D:\mongodb\bin\mongod.exe\ "--service--config=\" D:\mongodb\mongod.cfg\ "" Displayname= "MongoDB" start= "Auto"
Start the service:
Error starting Service:
FIX: Close the Services window (Computer Management window)
Delete, rebuild service
Run again: D:\mongodb\bin>mongod.exe
Workaround: Discover the created MongoDB service startup parameter, no increase --service (not sure if it's wrong here)
Then close the service window, delete the Rebuild service, and error
Resolution: To view the directory, it should be deleted by me. The first time I wanted to create a service with a command, I found that the service was already there and was deleted directly. So that a subsequent string of errors occurs. Delete the file mongod.exe . Find the installation package and copy it from here!
Start directly at the command line and find it OK. That might be a problem with the steps to create a service!
Check the command, sure enough there is a problem!
The configuration file (mongod.cfg) directory is: D:\mongodb\mongod.cfg, and the command error is: D:\mongodb\bin\mongod.cfg
--config=\ "D:\mongodb\bin\mongod.cfg\" "
Switch
--config=\ "D:\mongodb\mongod.cfg\" "
(Note: The command to create the service above has been changed to correct!) ~
Good! Now rebuild the service, success. Start the service, success! ~
But now when you connect to MongoDB, you have to access the bin directory every time you execute the command:
D:\mongodb\bin>mongo
The workaround is to add the directory to the system environment variable:
Add environment variables (note separating each variable with semicolons):
Right-click "My Computer"-"advanced"-"Environment variables"-Find "System variables"-Edit "path"-Append ";D: \mongodb\bin;"
Then change the variable at random on the command line, and then close the command line (for example):
SET Path=c:\
(This is just a variable that changes the current command-line Copy window and does not change the system's actual variable value, causing the system to refresh the variable)
Re-open the command line, enter MONGO, you can connect in!
At this point, it's done! ~
MongoDB Step by Step (i) Windows XP 32-bit installation MongoDB and its directory structure and configuration