標籤:etc sha tor roc epo process system kernel shell
MongoDB 3.2 在CentOS 上的安裝和配置 2016-01-06 14:41:41 發布
收藏 0收藏一、安裝
編輯/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
二、配置
編輯/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,<內網IP> # Listen to local interface only, comment to listen on all interfaces.注意不要逗號前後不要有空格#security:#operationProfiling:#replication:#sharding:## Enterprise-Only Options#auditLog:
執行
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag
編輯/etc/rc.local,添加
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag
編輯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
三、防火牆
iptables -I INPUT 10 -s <允許ip> -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPTiptables -A OUTPUT -d <允許ip> -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT
MongoDB 3.2 在CentOS 上的安裝和配置