1.NoSQL Introduction
- NoSQL, full name not only SQL, refers to a non-relational database
- With the increase in traffic, there is a problem with the database performance of the website, so NoSQL is designed
- Advantages and Disadvantages
Benefits High Scalability distributed computing the flexibility of a low-cost architecture with no complex relationship between semi-structured data
Disadvantages No Standardized limited query function (so far) eventually consistent is not intuitive program
2.MongDB Introduction
- MongoDB is a NoSQL database based on Distributed file storage
- Written by the C + + language, stable and high performance
- Designed to deliver scalable, high-performance data storage solutions for WEB applications
- View official website
MongoDB Features
- Mode freedom: You can store documents of different structures in the same database
- Collection-oriented storage: The format for storing JSON-style files
- Full index support: Index any property
- Replication and high availability: Supports data replication between servers, and supports replication between master-slave mode and server. The primary purpose of replication is to provide redundancy and automatic failover
- Automatic sharding: Supports cloud-scale scalability: auto-sharding supports level DB clusters, adding additional machines dynamically
- Rich query: Support rich query expression, query instructions using JSON form of tags, can easily query the document embedded objects and arrays
- Fast in-place updates: The query optimizer parses query expressions and generates an efficient query plan
- Efficient traditional storage: supports binary data and large objects (such as photos or pictures)
3. Installation of the environment
- Download MongoDB version, two points note
- According to industry rules, even a stable version, such as 1.6.X, odd for the development version, such as 1.7.X
- 32bit MongoDB can only store 2G of data, 64bit there is no limit
- To the official website, select the appropriate version to download
- Extract
TAR-ZXVF mongodb-linux-x86_64-ubuntu1604-3.4.0.tgz
- Move to the/usr/local/directory
sudo mv-r mongodb-linux-x86_64-ubuntu1604-3.4.0//usr/local/mongodb
- To add an executable file to a path path
Export Path=/usr/local/mongodb/bin: $PATH
4. Start the Mongod server
- Configuration file in/etc/mongod.conf
Default Port 27017
Start
sudo service Mongod start
sudo service Mongod stop
- Check if MongoDB started successfully
Determine whether the Mongod process has started successfully by examining the/var/log/mongodb/mongod.log file. or view the process
5.mongo Client
- Using Terminal connections
- This shell is the client of MongoDB, but also a JS compiler.
[Email protected]:~$ mongomongodb Shell version v3.4.0connecting to:mongodb://127.0.0.1:27017mongodb Server version: 3.2.8warning:shell and server versions do not matchserver have startup warnings:2018-02-08t10:06:20.621+0800 I Control
[initandlisten] 2018-02-08t10:06:20.621+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_ Hugepage/enabled is ' always '. 2018-02-08t10:06:20.621+0800 I CONTROL [initandlisten] * * We suggest setting it to ' Never ' 2018-02-08t10:06:20.621+0800 i control [Initandlisten] 2018-02-08t10:06:20.621+0800 i control [ Initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/defrag is ' always '. 2018-02-08t10:06:20.621+0800 I Control [Initandlisten] * * We suggest setting it to ' Never ' 2018-02-08t10:06:20.621+0800 I CONTROL
DB View Current database name Db.stats () view current database information
Exit or CTRL + C
6.gui:robomongo
- Gui:robomongo, unzip and locate the running program in the bin directory
- The interface is as follows:
1 MongoDB Installation