Mongo DB is a non-relational database (NOSQL) that is currently very popular in the IT industry, and its flexible data storage methods are favored by current it practitioners. Mongo db is a good way to implement object-oriented thinking, in Mongo db, each record is a document object. The biggest advantage of Mongo DB is that all data persistence requires no developers to write SQL statements manually, and it is easy to invoke methods to implement CRUD operations. Here is a description of how MongoDB is installed:
System Environment: CentOS 6.5
Mongo db:mongodb-linux-x86_64-2.6.5.tgz
1. Check if MongoDB has been installed, if installed, delete
# Rpm-qa | grep mongodb
2. Download MongoDB (download to/doiido/soft)
# Mkdir/doiido/soft
# wget Https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.5.tgz-P/doiido/soft
3. Decompress MongoDB
# Cd/doiido/soft
# tar ZXVF mongodb-linux-x86_64-2.6.5.tgz
# MV Mongodb-linux-x86_64-2.6.5/doiido/mongodb
4. Set up a storage directory for databases and logs
# Mkdir/doiido/mongodb/data
# Mkdir/doiido/mongodb/logs
# Touch/doiido/mongodb/logs/mongodb.log
5. Setting up the configuration file
# vi/doiido/mongodb/bin/mongodb.conf
Dbpath=/doiido/mongodb/data
Logpath=/doiido/mongodb/logs/mongodb.log
port=27017
Fork=true
Nohttpinterface=true
6. Start MongoDB
#/doiido/mongodb/bin/mongod--bind_ip localhost-f/doiido/mongodb/bin/mongodb.conf
7. Set Boot start
# echo "/doiido/mongodb/bin/mongod--config/doiido/mongodb/bin/mongodb.conf" >>/etc/rc.local
8. Testing
8.1. Enter MongoDB Shell mode
#/doiido/mongodb/bin/mongo
8.2. View the list of databases
> Show DBS
8.3. Current DB version
> Db.version ();
9. Stop MongoDB
9.1. Enter MongoDB Close
#/doiido/mongodb/bin/mongo
> Db.shutdownserver ();
9.2. Use MongoDB command to close
# Mongod--shutdown--config/doiido/mongodb/bin/mongodb.conf
9.3. Using the KILL command
# Ps-ef|grep MONGO
# Kill PID
Note: This place cannot use the kill-9 PID, which can result in data loss, and MongoDB may also error.
If MongoDB is turned off using kill-9 pid and MongoDB does not start normally, you need to delete the Mongod.lock file:
# rm-f/doiido/mongodb/data/mongod.lock
#/doiido/mongodb/bin/mongod--config/doiido/mongodb/bin/mongodb.conf
CentOS 6/linux Installation MongoDB 2.6.5