"One" MongoDB installation and configuration

Source: Internet
Author: User

One, MongoDB installation

1. Download and unzip

wget Https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.0.tgztar ZXVF mongodb-linux-x86_64- Rhel62-3.2.0.tgz

2. Move to the specified directory

MV Mongodb-linux-x86_64-rhel62-3.2.0/usr/local/mongodb

3. Add to Path

Vim/etc/profileexport Path=/usr/local/mongodb/bin: $PATHsource/etc/profile

Second, MongoDB Configuration Start

1. Create data directory and log directory

By default, the MongoDB data directory is in/data/db, and you need to specify the--dbpath parameter if you put it on another directory to start.

Mkdir-p/data/dbmkdir-p/data/logtouch/data/log/mongodb.log

2. Start Mongod Service

[Email protected] log]# mongod--dbpath=/data/db--fork--logpath=/data/log/mongodb.log  #默认启动27017端口
About-to-fork child process, waiting until server was ready for connections.
Forked process:45134
Child process started successfully, parent exiting

Parameter description:

--dbpath           #数据文件存储路径--fork             #用子进程在后台启动, otherwise has been occupied terminal, with this parameter, you must specify the LogPath parameter--logpath          # Log file storage path--httpinterface    #网页管理mongodb接口, the previous version is turned on by default, due to security, this version is turned off by default, if you need to add this parameter to start

3. Connect to MongoDB

[[email protected] ~]# mongomongodb Shell version:3.2.0connecting to:testwelcome to the MongoDB shell. For interactive help, type ' help '. For more comprehensive documentation, see http://docs.mongodb.org/Questions? Try the support group Http://groups.google.com/group/mongodb-userServer have startup warnings:2015-11-29t11:04:05.002+ 0800 I CONTROL [initandlisten] * * Warning:you is running this process as the root user, which was not recommended.2015-1 1-29t11:04:05.002+0800 I control [Initandlisten] 2015-11-29t11:04:05.002+0800 i control [Initandlisten] 2015-11-29T11 : 04:05.003+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/enabled is ' always '. 2015-11-29t11:04:05.003+0800 I CONTROL [initandlisten] * * We suggest setting it to ' Never ' 2015-11-29t11:04:05.003+ 0800 I control [Initandlisten] 2015-11-29t11:04:05.003+0800 i control [initandlisten] * * WARNING:/sys/kernel/mm/transpa Rent_hugepage/defrag is ' always '. 2015-11-29t11:04:05.003+0800 I control [initandlisten] * * We suggest setting it to ' Never ' 2015-11-29t11:04:05.003+0800 I control [Initandlis Ten] > 2+35

4. Close Mongod Service

Mongod--dbpath=/data/db--fork--logpath=/data/log/mongodb.log--shutdown

"One" MongoDB installation and configuration

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.