mongodb 启动 WARNING: soft rlimits too low, transparent_hugepage/enabled is 'always'. never
程序员文章站
2022-10-09 22:06:20
解决mongodb 启动告警
/sys/kernel/mm/transparent_hugepage/enabled is 'always'.
/sys/kernel/mm/transparent_hugepage/defrag is 'always'
soft rlimits too lo... ......
今天启动mongodb的时候,之前一直没注意,今天发现又warning,想整一整。
下面是告警
2019-09-05t12:00:55.271+0800 i control [initandlisten] 2019-09-05t12:00:55.271+0800 i control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2019-09-05t12:00:55.271+0800 i control [initandlisten] ** we suggest setting it to 'never' 2019-09-05t12:00:55.271+0800 i control [initandlisten] 2019-09-05t12:00:55.271+0800 i control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2019-09-05t12:00:55.271+0800 i control [initandlisten] ** we suggest setting it to 'never' 2019-09-05t12:00:55.271+0800 i control [initandlisten] 2019-09-05t12:00:55.271+0800 i control [initandlisten] ** warning: soft rlimits too low. rlimits set to 15012 processes, 102400 files. number of processes should be at least 51200 : 0.5 times number of files.
那我们一个个来解决:
transparent_hugepage ,
上面2个问题可以一起解决:
echo never >/sys/kernel/mm/transparent_hugepage/enabled echo never>/sys/kernel/mm/transparent_hugepage/defrag
soft rlimits too low
这个问题就是我们不能单单把ulimit -n 那个文件句柄数打开,还得同时提升用户可使用线程数
解决办法有几种,这里介绍一个比较快捷,可以及时生效的:
修改 /etc/security/limits.conf 文件,末尾添加:
* soft noproc 65535 * hard noproc 65535
然后 执行一步 ulimit -u 65535
- 第一步是永久生效process
- 第二步是即时当前会话生效process