CentOS Installation MongoDB

Source: Internet
Author: User
Tags install mongodb

1, Mongodb:http://www.mongodb.org/downloads, can find 32-bit tgz file address, such as: http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.2.tgz
2. Install MongoDB (install to/usr)
Cd/usr
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.2.tgz
Tar zxvf mongodb-linux-i686-2.4.2.tgz
MV mongodb-linux-i686-2.4.2 MongoDB (file Rename, move file and rename are the same command, MV (is the move) meaning)
CD MongoDB
mkdir data
CD data
mkdir db (Set up data file directory)
Cd.. /
mkdir logs (build log directory)
CD bin
VI mongodb.conf
3, mongodb.conf file input as follows:
DBPATH=/DATA/DB (see the W3cschool, the data directory can only be on the root directory, or there will be a problem from booting)
Logpath=/usr/mongodb/logs/mongodb.log
port=27017
Fork=true
Nohttpinterface=true
4. Enter the contents of the command line, rebind the configuration file address of MongoDB and access IP
/usr/mongodb/bin/mongod--bind_ip localhost-f/usr/mongodb/bin/mongodb.conf
5, Boot automatically start MongoDB
Vi/etc/rc.d/rc.local
/usr/mongodb/bin/mongod--config/usr/mongodb/bin/mongodb.conf (file input content)
6, restart the system, test can be self-starting
#进入mongodb的shell模式
/usr/mongodb/bin/mongo
#查看数据库列表
Show DBS
#当前db版本
Db.version ();
7. Configure Environment variables
Vi/etc/profile #添加环境变量, edit, and add the following code to the last line:
Export path= $PATH:/usr/mongodb/bin
Restart your computer after saving. This allows the database to be connected directly to the MONGO, without the need to enter/usr/mongodb/bin/mongo into MongoDB's shell mode like 5.

8, if after a startup, found that the input MONGO can not connect to the database, probably because the last time the shutdown caused by the failure, at this time to delete the/data/db directory mogod.lock files, restart.

9. MongoDB Management tool: Robomongo

CentOS Installation MongoDB

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.