MongoDB Learning
MongoDB Learning
说明: MongoDB由databases组成,database由collections组成,collection由documents组成,document由fileds组成。MongoDB是异步写数据。
First, MongoDB Introduction
- Functional characteristics
- Scope of application
Functional characteristics
官方网址:http://www.mongodb.org/ MongoDB是一个基于分布式文件存储的数据库开源项目。由C++语言编写,旨在为WEB应用提供可护展的高性能数据存储解决方案。 它的特点是可扩展,高性能,易使用,模式自由,存储数据非常方便等,主要功能特性有: 面向文档存储:(类JSON数据模式简单而强大)。
- Efficient traditional storage: supports binary data and large objects such as photos and videos.
- Replication and automatic failover: The MONGO database supports data replication between servers, supporting master-slave mode and inter-server replication.
- Auto-sharding Auto-sharding supports cloud-scale scalability (in the early alpha phase): Auto-sharding supports a level of database clustering and dynamically adds additional machines.
- Dynamic query: It supports rich query expressions. Query directives use a JSON-style tag to easily query objects and arrays embedded in the document.
- Full index support: Includes embedded objects and arrays in the document. The query optimizer of MONGO parses the query expression and generates an efficient query plan.
- Supports multiple languages such as ruby,python,java,c++,php.
Applicable to the scope of the scenario:
- Suitable for real-time inserts, updates and queries, with the replication and high scalability required for real-time data storage of applications.
- A persistent caching layer for the information infrastructure.
- Suitable for databases made up of dozens of or hundreds of servers. Because MONGO already contains built-in support for the MapReduce engine.
- MONGO's Bson data format is ideal for storing and querying in a document format.
Scenario Not applicable:
- A highly transactional system.
- Traditional business intelligence applications.
- A complex SQL query.
Second, MongoDB download and installation
Http://www.mongodb.org/downloads, select the appropriate version to download
Installation steps
- In (c/d/e/f) disk new Folder MongoDB.
- Unzip the downloaded file and copy the bin directory to the folder MongoDB.
- Create a new folder under the folder MongoDB data, the folder data under the new folder DB and log (db is the database file, log below the Windows log, will be explained later).
- Execute command: "Mongod-dbpath" E:\mongodb\data\db "" creates the MongoDB database file into the E:\mongodb\data\db directory, and the database is started.
Third, MongoDB service management
- Window Service Registration
- Service Opening and closing
Window Service Registration
Using the command "Mongod--install--servicename mongodb--servicedisplayname mongodb--logpath E:\mongodb\data\log\mongodb.log-- DBPath E:\MongoDB--directoryperdb "registers the window service.
Service Opening and closing
Use the command "net stop MongoDB" to close the MongoDB service.
Use the command "net start MongoDB" to start the MongoDB service.
MongoDB Learning Note One (MongoDB environment configuration)