系統內容
Distributor ID: CentOSDescription: CentOS release 6.7 (Final)Release: 6.7Codename: 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
sudo echo "never" > /sys/kernel/mm/transparent_hugepage/enabledsudo echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
第三個warning
vim /etc/security/limits.conf添加一下幾行mongod soft nofile 64000mongod hard nofile 64000mongod soft nproc 32000mongod hard nproc 32000
重啟mongod
sudo service mongod restart
成功
重啟成功之後,所有報錯都沒啦,如下
➜ ~ git:(master) mongoMongoDB shell version: 3.2.6connecting to: test>