今天启动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