CentOS-7-x86_64-Everything-1511
mongodb-linux-x86_64-rhel70-3.4.2
1)查看
# uimit -a
2)配置 open files
# echo "* soft nofile 65535" >> /etc/security/limits.conf # echo "* hard nofile 65535" >> /etc/security/limits.conf
3)配置 max processes
# ulimit -u 65535
注意:修改后仅在当前 shell 中生效,所以请确保在当前 shell 中启动 MongoDB 。如果退出重登录,需要重新进行设置。
4)修改 transparent_hugepage
# echo "never" > /sys/kernel/mm/transparent_hugepage/enabled # echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
注意:修改后如果重新启动主机,则需要重新执行上述命令。
5)修改 zone_reclaim_mode
# echo 0 > /proc/sys/vm/zone_reclaim_mode
mongodb-linux-x86_64-rhel70-3.4.2.tgz
# tar zxvf mongodb-linux-x86_64-rhel70-3.4.2.tgz
# mv mongodb-linux-x86_64-rhel70-3.4.2 mongodb # cd mongodb # mkdir logs # mkdir dbfile
# vi mongo.conf
配置文件内容:
systemLog: destination: file path: /root/mongodb/logs/mongo.log logAppend: true storage: journal: enabled: true dbPath: /root/mongodb/dbfile/ directoryPerDB: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 20 directoryForIndexes: true indexConfig: prefixCompression: true processManagement: fork: true net: port: 27017 replication: replSetName: rs1 oplogSizeMB: 250000
# cd mongodb/bin
# ./mongod --config ../mongo.conf
原文:http://www.cnblogs.com/RUReady/p/6475335.html