時(shí)間:2024-02-08 11:17作者:下載吧人氣:27
MongoDB的登錄測(cè)試
mongo 命令
mongodb提供一個(gè)客戶端,類似于mysql提供的客戶端命令
#默認(rèn)連接到127.0.0.1:27017
/usr/local/mongodb/bin/mongo
mongodb啟動(dòng)優(yōu)化說(shuō)明
WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
建議使用 xfs 文件系統(tǒng)
WARNING: Access control is not enabled for the database.
Read and write access to data and configuration is unrestricted.
建議開啟權(quán)限控制
WARNING: You are running this process as the root user, which is not recommended.
不建議root用戶啟動(dòng)
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’
解決:mongodb啟動(dòng)參數(shù)優(yōu)化1,禁止內(nèi)存巨大頁(yè)
echo ‘never’ >/sys/kernel/mm/transparent_hugepage/enabled
echo ‘never’ >/sys/kernel/mm/transparent_hugepage/defrag
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.
內(nèi)核進(jìn)程數(shù)限制放開/etc/security/limits.conf,需要重新登錄
* – nproc 65536
使用普通用戶啟動(dòng)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
設(shè)置進(jìn)程數(shù)據(jù)限制
centos7默認(rèn)還有進(jìn)程數(shù)限制/etc/security/limits.d/20-nproc.conf
[root@5e7b4039fa6f ~]# more /etc/security/limits.d/20-nproc.conf
# Default limit for number of user’s processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc unlimited
訪問(wèn)控制建議設(shè)置ip白名單訪問(wèn)
網(wǎng)友評(píng)論