1. 程式人生 > >mongodb 啟動 WARNING: soft rlimits too low, transparent_hugepage/enabled is 'always'. never

mongodb 啟動 WARNING: soft rlimits too low, transparent_hugepage/enabled is 'always'. never

今天啟動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
  • 第二步是即時當前會