mongodb 启动 WARNING: soft rlimits too low, transpar

今天启动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
上一篇:mongoDB入门系列之配置解释及错误汇总


下一篇:将 云数据库MongoDB(阿里云)物理备份文件下载恢复至本地自建数据库 遇到的三个问题