Because the project team needs to develop the big Data management analysis system, but also want to use the relevant software and libraries are open source, so the choice of the use of MongoDB This non-relational, structured organization more flexible open source database. At the same time, the reason for writing this document is to think that there are too many cluttered tutorials and meaningless nonsense on the web, so I've tidied up the entire deployment tutorial, with as little nonsense as possible in the steps section.
First, MongoDB Basic Features
For developers, choosing MongoDB needs to understand its superior features compared to other databases, as this article focuses on the deployment of MongoDB in a Windows environment, so here are just a few features.
1 , flexible data organization
The Mongodb database is a document-based store, not a table based, and its storage unit is similar to JSON 's bson format, and is a flexible weakly typed structure . if the user needs to store the data, there is no need to know the structure of the data, just storing the data in JSON format. The basic idea is to transform the idea of " row " into a more flexible document model. A document-oriented approach allows you to embed a document or an array and represent very complex hierarchical relationships with a single record.
2 , easy to expand
As the size of the application dataset grows rapidly, the storage of big data becomes a problem that needs to be solved now. The data developers are going to store is growing , and they are faced with the choice of upgrading the database ( a better server ) or extending the database ( spreading the data across many machines ) . Upgrading a database is usually the least effort , but expensive. But the expansion is not only economical but also continues to increase : to increase storage space or improve performance , just buy a common server to join the cluster. MongoDB 's initial design takes into account the problem of scaling , which uses a document-oriented data model that automatically splits data across multiple servers and balances the data and load of the cluster.
3 , High performance
MongoDB Dynamically fills the document , Pre-allocates data files , and uses space for stable performance. The memory-mapped file is used in its default storage engine , and the memory management is given to the operating system for processing, and the dynamic query optimizer " remembers " the most efficient way to execute the query. while MongoDB is powerful and maintains the many features of this relational database , It gives the client the server processing logic as much as possible , This streamlined design allows MongoDB to have very efficient query performance .
Second, MongoDB Environment Deployment
1 , software download
https://www.mongodb.com/download-center#community;
Win8,Win7 , and Windows Latest version:MongoDB for Windows 64-bit
windowsVista: Mongodb for Windows 32-bit
indows Vista, Windows Server 2003,: MongoDB forWindows 64-bit Legacy
2 , Custom installation Custom
Select the installation path D:\MongoDB;
3 , create folders
Create D:\ separately Mongodb\data\db, D:\ Mongodb\data\dbconf folder while creating the D:\ Mongodb\data\dbconf\mongdb.log file;
The former is used to install DB database files and log files, which are used to store log information for the MONGDB service runtime.
4 , starting the server under the command line
Run cmd.exe into the DOS command interface and execute the following commands (the specific file location is set according to the folder you installed).
> CD D:\MongoDB\Server\3.4\bin
> D:\mongodb\server\3.4\bin>mongod-dbpath "D:\MongoDB\data\db"
Access to the http://127.0.0.1:27017/, the interface display, the start is successful;
5 , the MongoDB Services as Windows Service Run (note that the command requires a blank space, you may be copied due to the format of confusion, remember!) )
When Mongod.exe is closed, Mongo.exe cannot connect to the database, so it is troublesome to open the Mongod.exe program every time you want to use the MongoDB database, so we can install MongoDB as a Windows service at this time. Administrator privileges to run Cmd.exe into the DOS command interface, execute the following command .
> CD D:\MongoDB\Server\3.4\bin
> d:\mongodb\bin> mongod--logpath "D:\MongoDB\data\dbConf\mongodb.log"--logappend--dbpath "d:\ Mongodb\data\db"--servicename"mongodb"--servicedisplayname"mongodb"--directoryperdb --Install
See if MongoDB exists in the service and the installation is successful.
If you later need to set the database to Safe mode (requiring a user name password for authentication), you need to close the service and then reinstall it by executing the following command under the CMD command-line window.
> CD D:\MongoDB\Server\3.4\bin
> D:\mongodb\bin>mongod--auth--logpath "D:\MongoDB\data\dbConf\mongodb.log"--logappend--dbpath " D:\MongoDB\data\db"--servicename"mongodb"--servicedisplayname"mongodb"-- Directoryperdb--reinstall
PS: the 5th chapter Blue words according to their own path, respectively, the MongoDB log file, MongoDB db file location, MongoDB as the name of the Windows service, the service name displayed in the system (for the difference when there are multiple MongoDB services).
Third , summary
At this point, the basic environment of MONGODB has been configured successfully, but the environment configuration is only the most basic part of using MONGDB, and I will continue to update some of the technology and information for the actual application of MongoDB in the project, such as some grammatical knowledge of mongdb; in Java background, How MongoDB is used on the front-end server, and how to deploy and operate a distributed MONGDB environment. In addition, in order to facilitate the use of MongoDB here Robotmongdb as a visual tool for MongoDB, the interface is very friendly, easy to get started, but also a free GUI tool.
MONGODB Basic Environment Deployment (under Windows System)