MongoDB Getting Started Installation

Source: Internet
Author: User
Tags openssl iptables



---1. Turn off Numa in proc
Rpm-qa | grep numactl


Yum Install-y Numactl


# echo 0 >/proc/sys/vm/zone_reclaim_mode
# sysctl-w Vm.zone_reclaim_mode=0




---2. Modify the maximum number of connections


#vi/etc/security/limits.conf


* Soft Nofile 25000
* Hard Nofile 25000




---3. Turn off the firewall


Chkconfig--level 123456 iptables off


Service Iptables Stop




---4. Modify the Hosts


Vi/etc/hosts



---5. Installing MongoDB


--Installing OpenSSL
Yum install-y Openssl-devel OpenSSL


Tar xvzf mongodb-linux-x86_64-rhel62-3.0.5.gz




Mkdir-p/data/mongodb
Mkdir-p/data/mongodb/db
Mkdir-p/data/mongodb/logs
Mkdir-p/data/mongodb/apps


Mkdir-p/data/mongodb/{db,logs,apps}


Touch/data/mongodb/logs/mongodb.log
Chmod-r 777/data/mongodb/logs/mongodb.log


MV Mongodb-linux-x86_64-rhel62-3.0.5/data/mongodb/apps/mongodb










# Cd/data/mongodb/apps/mongodb/bin


# vi/data/mongodb/apps/mongodb/bin/mongodb.conf
port=27017 #端口
Dbpath=/data/mongodb/db #数据文件存放目录
Logpath=/data/mongodb/logs/mongodb.log #日志文件存放目录
Logappend=true #使用追加的方式写日志
Fork=true #以守护程序的方式启用, which runs in the background
maxconns=5000 #最大同时连接数 Default 2000
bind_ip=127.0.0.1,192.168.1.25 #只允许通过局域网IP192.168.1.25 and native access
Noauth=true #不启用验证
Nohttpinterface=true
Rest=false
Syncdelay=60




Start MongoDB
# Numactl--interleave=all/data/mongodb/apps/mongodb/bin/mongod--config/data/mongodb/apps/mongodb/bin/ Mongodb.conf
Or
# Numactl--interleave=all/data/mongodb/apps/mongodb/bin/mongod-f/data/mongodb/apps/mongodb/bin/mongodb.conf


About-to-fork child process, waiting until server was ready for connections.
Forked process:3765
Child process started successfully, parent exiting




---mongodb connection


#/data/mongodb/apps/mongodb/bin/mongo
MongoDB Shell version:3.0.5
Connecting To:test
Welcome 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-user
Server has startup warnings:
2015-08-03t12:39:33.996+0800 i CONTROL [initandlisten] * * Warning:you is running this process as the root user, which I s not recommended.
2015-08-03t12:39:33.996+0800 I CONTROL [Initandlisten]
2015-08-03t12:39:33.996+0800 I CONTROL [Initandlisten]
2015-08-03t12:39:33.996+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/enabled is ' Always '.
2015-08-03t12:39:33.996+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2015-08-03t12:39:33.996+0800 I CONTROL [Initandlisten]
2015-08-03t12:39:33.996+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/defrag is ' Always '.
2015-08-03t12:39:33.996+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2015-08-03t12:39:33.996+0800 I CONTROL [Initandlisten]
>


/****************** Solutions


Do not restart the server in case of a workaround, under Linux execution:
echo Never >/sys/kernel/mm/transparent_hugepage/enabled
echo Never >/sys/kernel/mm/transparent_hugepage/defrag




Immediate effect after server restart:
# vi/etc/rc.local
If Test-f/sys/kernel/mm/transparent_hugepage/enabled; Then
echo Never >/sys/kernel/mm/transparent_hugepage/enabled
Fi
If Test-f/sys/kernel/mm/transparent_hugepage/defrag; Then
echo Never >/sys/kernel/mm/transparent_hugepage/defrag
Fi


********************/


----Normal Stop method:
# PS aux | grep Mongod
Root 3765 1.9 0.1 500832 58224? Sl 12:38 0:02/data/mongodb/apps/mongodb/bin/mongod--config/data/mongodb/apps/mongodb/bin/mongodb.conf




# Kill-2 3765
Or
#/data/mongodb/apps/mongodb/bin/mongo-port 27107
> Use admin
> Db.shutdownserver ();

----Boot automatically start MongoDB
# vi/etc/rc.d/rc.local
Rm-rf/data/mongodb/db/mongod.lock
Numactl--interleave=all/data/mongodb/apps/mongodb/bin/mongod--config/data/mongodb/apps/mongodb/bin/ Mongodb.conf


Note: Numactl must be added at startup--interleave=all



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MongoDB Getting Started Installation

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.