mongodb之啓動優化

1、當用客戶端登陸到數據庫時,會提示警告信息
mongodb

mongodb啓動警告數據庫

WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage enginecentos

文件系統類型,安裝系統時設置的。安全

df -h  #查看bash

WARNING: Access control is not enabled for the database.ide

         Read and write access to data and configuration is unrestricted.優化

數據庫安全,權限,用戶問題this

WARNING: You are running this process as the root user, which is not recommended.centos7

非root用戶登陸數據庫spa

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'

啓動參數優化1,禁止內存巨大頁

WARNING: soft rlimits too low. rlimits set to 3895 processes, 65535 files. Number of processes should be at least 32767.5 : 0.5 times number of files.

內核進程數設置


一、內核進程數限制放開

修改文件/etc/security/limits.conf,須要從新登陸

* - nproc 65536

二、mongodb啓動參數優化1,禁止內存巨大頁

echo 'never' >/sys/kernel/mm/transparent_hugepage/enabled
echo 'never' >/sys/kernel/mm/transparent_hugepage/defrag

可以下次開機啓動實現,加入啓動文件/etc/rc.local。centos7的此文件沒有執行權限。

把命令加入/etc/rc.local

chmod +x /etc/rc.d/rc.local #支持執行權限

三、使用普通用戶啓動mongodb

useradd mongodb -s /sbin/nologin
chown -R mongodb:mongodb /data/mongodb/ /usr/local/mongodb/
su - mongodb -s /bin/bash
/usr/local/mongodb/bin/mongod -f /data/mongodb/27017/mongodb.conf

四、centos7默認進程數限制

修改/etc/security/limits.d/20-nproc.conf   
65536
相關文章
相關標籤/搜索