MongoDB Introduction and Installation

Source: Internet
Author: User
Tags failover mongodump mongorestore

First,MongoDB Introduction
 
MongoDB is a high-performance, open-source, modeless document-based database that is a popular one in the current NoSql database. It can be used in many scenarios to replace the traditional relational database or key / value storage methods. Mongo is developed using C + + . Mongo 's official website address is:http://www.mongodb.org/, where readers can get more detailed information.

 
1.What is NoSql?
nosql not only SQL, web Application, this movement began in 2009 at the beginning of the year, typical features such as mode freedom, simple copy support, Simple api , final consistency (not acid nosql We use the most when the number of key-value storage, and of course, other document-type, Columnstore, graph-based databases, xml database, etc.
 
2. Features :
high performance, easy to deploy, easy to use, easy to store data. The main features are:
1) for collection storage, easy to store the object type of data.
2) mode freedom.
3) support dynamic query.
4) full index support, including internal objects.
5) support query.
6) support replication and recovery.
7) use efficient binary data storage, including large objects (such as video, etc.).
8) automatically process fragmentation to support scalability at the cloud level
9) SupportPython,PHP,Ruby,Java,C,C #,Javascript,PerlandC + +language drivers, the community also providesErlangand. NETand other platform drivers.
thefile storage format is BSON(a JSON extension).
can be accessed over the network.
 
3. function :
1) Collection-oriented storage: suitable for storing objects and data in JSON form.
2) dynamic query:Mongo supports rich query expressions. Query directives use a JSON -style tag to easily query objects and arrays embedded in the document.
3) 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.
4) query monitoring:Mongo contains a monitoring tool to analyze the performance of database operations.
5) replication and automatic failover:theMongo Database supports data replication between servers and supports replication between master - slave mode and server. The primary goal of replication is to provide redundancy and automatic failover.
6) Efficient traditional storage: supports binary data and large objects (such as photos or pictures)
7) Auto-shard to support cloud-level scalability: Automatic sharding supports a level of database clustering, adding additional machines dynamically.

 
4, Applicable occasions :
1) website data:Mongo is ideal for real-time inserts, updates and queries, as well as the replication and high scalability required for real-time data storage on the site.
2) cache: Due to high performance,Mongo is also suitable as a caching layer for information infrastructure. After the system restarts, The persistent cache layer built by Mongo can avoid overloading the underlying data sources.
3) Large, low-value data: it can be expensive to store some data using a traditional relational database, and many times programmers often choose traditional files for storage.
4) Highly scalable scenario:theMongo is ideal for databases consisting of dozens of or hundreds of servers. built-in support for the MapReduce engine is already included in the roadmap for Mongo .
5) storage for objects and JSON data:Mongo 's BSON The data format is ideal for storing and querying in a document format.


Second, download the installation and configuration:
1. Decompression
# TAR-ZXVF Mongodb-linux-x86_64-2.4.9.tgz
# mv Mongodb-linux-x86_64-2.4.9/usr/local/mongodb

2. Create data and log directories
# mkdir-p/usr/local/mongodb/data
# mkdir-p/usr/local/mongodb/logs

3. Command path optimization
# ln-s/usr/local/mongodb/bin/mongo/usr/sbin/mongo
# ln-s/usr/local/mongodb/bin/mongodump/usr/sbin/mongodump
# ln-s/usr/local/mongodb/bin/mongod/usr/sbin/mongod
# ln-s/usr/local/mongodb/bin/mongorestore/usr/sbin/mongorestore

4. Start MongoDB
# mongod--dbpath=/usr/local/mongodb/data/--logpath=/usr/local/mongodb/db.logs--fork-smallfiles

5.View MongoDB running status
# Ps-aux | grep MONGO
# NETSTAT-ANPT | grep MONGO

6. Add as Auto start
# vim/etc/rc.d/rc.local
Add:
/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data/--logpath=/usr/local/mongodb/db.logs--fork- Smallfiles

7. Login to mongodb Database (default is test database)
#/usr/local/mongodb/bin/mongo


This article is from the "11628205" blog, please be sure to keep this source http://11638205.blog.51cto.com/11628205/1917201

MongoDB Introduction and Installation

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.