MongoDB的学习与应用一:安装并简单测试MongoDB


MongoDB是一种强大、灵活、可拓展的数据存储方式。它扩展了关系型数据库等,吧啦吧啦一大堆废话,对于一门新的语言或者技术,了解技术背景是一方面,动手实练也是必不可少的。这里我打算发一些MongoDB从入门到项目应用的文章,也方便做些技术预言。将涉猎到MongoDB基础应用入门以及分布式部署等等方面。

    一:从mongodb.org官网入手,了解MongoDB


从MongoDB官网下载最新的文档来看看,当然可以选择下载文档(MongoDB-manual.pdf)到本地以供检索,MongoDB作为开源的NoSQL数据库还带来了灵活、高效易扩展等优势。

Document Database

A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.

A MongoDB document.

The advantages of using documents are:

  • Documents (i.e. objects) correspond to native data types in many programming language.
  • Embedded documents and arrays reduce need for expensive joins.
  • Dynamic schema supports fluent polymorphism.

Key Features

High Performance

MongoDB provides high performance data persistence. In particular,

  • Support for embedded data models reduces I/O activity on database system.
  • Indexes support faster queries and can include keys from embedded documents and arrays.

High Availability

To provide high availability, MongoDB’s replication facility, called replica sets, provide:

  • automatic failover.
  • data redundancy.

A replica set is a group of MongoDB servers that maintain the same data set, providing redundancy and increasing data availability.

Automatic Scaling

MongoDB provides horizontal scalability as part of its core functionality.

  • Automatic sharding distributes data across a cluster of machines.
  • Replica sets can provide eventually-consistent reads for low-latency high throughput deployments.

     二:安装并简单测试MongoDB数据库,熟悉简要的命令


安装非常简单,只需要在官网下载MongoDB最新程序,解压到本地磁盘即可。剩下的就是简单配置和测试使用了。
把MongoDB解压到本地E:\mongodb下 并新建一个db文件夹用作数据存储。做完如上操作后,在CMD敲入命令,到E:\mongodb\bin 目录下,开启MongDB服务并设置数据存储路径(dbpath) 。

MongoDB的学习与应用一:安装并简单测试MongoDB_第1张图片

控制台提示,可通过http://localhost:28017/ 访问MongoDB Web Console。

重新打开一个CMD窗口,进入MondoDB bin文件路径后,使用mongo命令打开控制台并自动连接到test db。操作到此,就是已经完整的安装并调试了本地MongoDB服务。






你可能感兴趣的:(MongoDB的学习与应用一:安装并简单测试MongoDB)