系統環境
[code]Distributor ID: CentOS
Description: CentOS release 6.7 (Final)
Release: 6.7
Codename: Final
問題描述
在系統上安裝mongodb之後報錯。
(安裝教程地址: https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/)
錯誤信息:
WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.We suggest setting it to ‘never’
WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.We suggest setting it to ‘never’
WARNING: soft rlimits too low. rlimits set to 1024 processes, 65535 files. Number of processes should be at least 32767.5 : 0.5 times number of files.
如圖:
解決方案
前兩個warning
[code]sudo echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
sudo echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
第三個warning
[code]vim /etc/security/limits.conf
添加一下幾行
mongod soft nofile 64000
mongod hard nofile 64000
mongod soft nproc 32000
mongod hard nproc 32000
重啟mongod
[code]sudo service mongod restart
成功
重啟成功之後,所有報錯都沒啦,如下
[code]➜ ~ git:(master) mongo
MongoDB shell version: 3.2.6
connecting to: test
>