MongoDB 3.2 Installation and configuration on CentOS 2016-01-06 14:41:41 release
Collection0 CollectionFirst, installation
Edit/etc/yum.repos.d/mongodb-org-3.2.repo
[Mongodb-org-3.2]name=mongodb repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2 /x86_64/gpgcheck=0enabled=1
Yum Install-y mongodb-org
Second, the configuration
Edit/etc/mongod.conf
# mongod.conf# for documentation of all options, see:# Http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log# where and how to store data.storage: dbpath: /data/mongo journal: enabled: true# engine:# mmapv1:# wiredTiger:# how the process runsprocessManagement: fork: true # fork and run in background pidfilepath: /var/run/mongodb/mongod.pid # location of pidfile# network interfacesnet: port: 27017 bindip: 127.0.0.1,< Intranet Ip> # listen to local interface only, comment to listen on all interfaces. Be careful not to have a space before or after a comma #security:# Operationprofiling: #replication: #sharding: ## enterprise-only options#auditlog:
Perform
echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabledecho never >/sys/kernel/mm/transparent_ Hugepage/defrag
Edit/etc/rc.local, add
echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabledecho never >/sys/kernel/mm/transparent_ Hugepage/defrag
Edit vi/etc/security/limits.d/99-mongodb-nproc.conf
# Default limit for number of user ' s processes to prevent# accidental fork bombs.# See Rhbz #432903 for reasoning.* Soft Nproc 35000root Soft Nproc Unlimited
Third, the firewall
Iptables-i INPUT 10-s < Allow ip>-p TCP--destination-port 27017-m state--state new,established-j acceptiptables-a Output-d < Allow ip>-p TCP--source-port 27017-m state--state established-j ACCEPT
MongoDB 3.2 Installation and configuration on CentOS