CentOS 6/linux Installation MongoDB 2.6.5

Source: Internet
Author: User

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

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.