Brief 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)
Packages Package Description
The MongoDB official source contains the following dependent packages:
MONGODB-ORG:MONGODB metadata package, install the following four packages automatically:
1.mongodb-org-server: Contains the MongoDB daemon and related configuration and initialization scripts.
2.mongodb-org-mongos: Contains the daemon for MONGOs.
3.mongodb-org-shell: Contains the MONGO shell.
4.mongodb-org-tools: Tools with MongoDB: Mongoimport, Bsondump, Mongodump, Mongoexport, Mongofiles, Mongooplog, Mongoperf, Mongorestore, Mongostat, and Mongotop.
Installation Steps
1. Configure the Yum source for MongoDB
Vim/etc/Yum.repos.d/Mongodb-Org-3.4. repo# Add the following:[mongodb-org-3.4]name=MongoDB Repository BaseURL=Https//repo.mongodb.org/Yum/Redhat/$releasever/Mongodb-Org/3.4/x86_64/Gpgcheck=1enabled=1Gpgkey=Https//www.mongodb.org/Static/Pgp/Server-3.4.ASC#这里可以修改 Gpgcheck=0, eliminating GPG verification
[email protected] ~]# Yum Makecache
2. Installing MongoDB
installation command:
-y install mongodb-org
After installation is complete
View MONGO Installation Location:
Whereis Mongod
To view the modified configuration file:
/etc/mongod.conf
3. Start MongoDB
Start MongoDB:
Systemctl Start Mongod.service
Stop MongoDB:
Systemctl Stop Mongod.service
To find the status of MongoDB:
Systemctl Status Mongod.service
4. External network access requires the firewall to be turned off:
Close firewall:
Systemctl Stop Firewalld.service #停止firewallsystemctl disable Firewalld.service #禁止firewall开机启动
5. Start the MONGO Shell
Command:
To view the database:
Show DBS
6. Set up MongoDB remote access:
Edit mongod.conf Comment bindipand restart MongoDB. (This configuration represents only native use, so note)
/etc/mongod.conf
Restart MongoDB for the changes to take effect:
Systemctl Restart Mongod.service
You can use MongoDB as usual here.
Centos7 under Yum install MongoDB