mongodb 3.2.x 启动 Warning 错误处理
Posted 数据库探索
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb 3.2.x 启动 Warning 错误处理相关的知识,希望对你有一定的参考价值。
[[email protected] data1]# mongod --dbpath=/data/data1/mongodb_data/ --directoryperdb ** WARNING: You are running this process as the root user, which is not recommended. ** WARNING: You are running on a NUMA machine. ** We suggest launching mongod like this to avoid performance problems: ** numactl --interleave=all mongod [other options] ** 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 30000 processes, 65530 files. Number of processes should be at least 32765 : 0.5 times number of files. [[email protected] data1]# echo never>/sys/kernel/mm/transparent_hugepage/enabled [[email protected] data1]# echo never>/sys/kernel/mm/transparent_hugepage/defrag [[email protected] data1]# cat /etc/security/limits.conf #--------------------------------------------------
#此处经过测试知:只要 nproc * 2【0.5倍的nofile】 >= nofile > 32767【推荐】 * - nproc 65538 * - nofile 65536 #-------------------------------------------------- [[email protected] data1]# numactl --interleave=all mongod --dbpath=/data/data1/mongodb_data/ --directoryperdb & [1] 3847 [[email protected] data1]# 2018-11-12T11:35:49.699+0800 I CONTROL [initandlisten] MongoDB starting : pid=3847 port=27017 dbpath=/data/data1/mongodb_data/ 64-bit host=restore1 2018-11-12T11:35:49.699+0800 I CONTROL [initandlisten] db version v3.2.4 ... ...
mongodb shell 编写js脚本:循环遍历
var cols=db.getCollectionNames(); for (var i=0 ;i<cols.length;i++) {
var n=cols[i];
var v=db.getCollection(n).count();
print (n.pad(30,true) + " : " + v);
}
以上是关于mongodb 3.2.x 启动 Warning 错误处理的主要内容,如果未能解决你的问题,请参考以下文章
mongodb WARNING:transparent_hugepage/enabled
mongodb 安装后 出现警告:** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000(示