MongoDB configuration using Mac OS

Source: Internet
Author: User
Tags install mongodb

What is MongoDB?

MongoDB is a NoSQL database of document storage, NoSQL databases are non-relational databases

Relational database four principles acid
    1. Atomicity of Atomicity
    2. Conformance consistency
    3. Independence isolation
    4. Persistent durability
NoSQL Database

Unlike traditional relational databases, collectively referred to as NoSQL databases. Ideal for handling very large data.

The No:sql (East) symposium, held in Atlanta in 2009, was a milestone with the slogan "Select Fun, Profit from Real_world where Relational=false;". Therefore, the most common explanation for NoSQL is "non-associative", emphasizing the advantages of Key-value Stores and the documentation database , rather than simply opposing the RDBMS.

Cap theorem (Cap theorem)

In computer science, the cap theorem (Cap theorem), also known as the Brewer's theorem (Brewer's theorem), points out that it is impossible for a distributed computing system to meet the following three points:
-Conformance consistency
-Availability of availability
-Delimited tolerance Partition tolerance

The CAP considers that a distributed system can meet at most two points above three o'clock, so there are:
CA principles, CP Principles, AP Principles
-CA single-point clusters, systems that meet consistency, availability, and generally are not high on scalability
-CP satisfies the system of consistency and separation tolerance, usually not very good in performance
-APs are systems that meet availability, segmentation tolerance, and are often less likely to require consistency

Base principle

The principles of NoSQL databases
-Basic Available availability
-Soft-state Soft State/Flexible transaction (can be understood as non-connected)
-eventually consistency final consistency

NoSQL Database Classification

RDBMS vs NoSQL

Rdbms
-Highly organized structured data
-Structured Query Language (SQL) (SQL)
-Data and relationships are stored in separate tables.
-Data manipulation language, data definition language
-Strict consistency
-Basic services

Nosql
-represents more than just SQL
-No declarative query language
-No pre-defined pattern
-key-value pair storage, column storage, document storage, graphics database
-final consistency, not ACID properties
-Unstructured and unpredictable data
-Cap theorem
-High performance, high availability and scalability

Install (MacOS) 1. Homebrew Installation
brew update brew install mongodbbrew install mongodb --with-openssl //带TLS/SSL支持brew install mongodb --devel //获取最新版本的
2. Create a new/data/db directory
sudo mkdir -p /data/db
3. Start the service
sudo mongod //如果给/data/db加了权限的话,可以省掉sudo
4. Background Management Shell

If you need to get into MongoDB background management, you need to first open the bin directory under the MongoDB directory and then execute the MONGO command file.
The MongoDB Shell is an interactive Javascript shellthat comes with MongoDB and is used to manipulate and manage MongoDB.
When you enter MongoDB background, it is linked to the test document (database) by default

$ cd /usr/local/bin #其实我不用打开这个,直接用mongo也是可以的$ ./mongo> 2+24> db.runoob.insert({x:10})WriteResult({ "nInserted" : 1 })> db.runoob.find(){ "_id" : ObjectId("5604ff74a274a611b0c990aa"), "x" : 10 }

5. MongoDb Web user interface

MongoDB provides a simple HTTP user interface. If you want to enable this feature, you need to specify the parameter –rest at boot time.

$ mongod --rest

Basic use

See above

Used in conjunction with Python

With Pymongo

import pymongo client = pymongo.MongoClient(‘127.0.0.1‘,30017)client.bigsci.authenticate(‘username‘,‘password‘) #给某个数据库授权db         = client.bigsci          #选择一个数据库collection = db.wiki                #选择一个集合res        = collection.find_one()  #查询

MongoDB configuration using Mac OS

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.