Getting started with mongodb installation and getting started with mongodb

Source: Internet
Author: User
Tags install mongodb install openssl

Getting started with mongodb installation and getting started with mongodb


--- 1. Disable 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. Disable the Firewall


Chkconfig -- level 123456 iptables off


Service iptables stop




--- 4. Modify hosts


Vi/etc/hosts



--- 5. Install mongodb


-- Install 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 # port
Dbpath =/data/mongodb/db # data file storage directory
Logpath =/data/mongodb/logs/mongodb. log # log file storage directory
Logappend = true # Use APPEND to write logs
Fork = true # enabled as a daemon, that is, running in the background
MaxConns = 5000 # maximum number of simultaneous connections default 2000
Bind_ip = 127.0.0.1, 192.168.1.25 # Only access via LAN IP192.168.1.25 and Local Machine
Noauth = true # do not enable verification
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 is 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 are running this process as the root user, which is 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 'alway '.
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 'alway '.
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]
>


/******************* Solution


If you do not restart the server, run the following command in Linux:
Echo never>/sys/kernel/mm/transparent_hugepage/enabled
Echo never>/sys/kernel/mm/transparent_hugepage/defrag




Effective immediately 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 rjd
Root 3765 1.9 0.1 500832 58224? Sl/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 ();

---- Automatically start mongodb upon startup
# 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 -- interleave = all must be added at startup.



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.