今天啓動mongodb的時候,以前一直沒注意,今天發現又warning,想整一整。mongodb
下面是告警bash
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.
複製代碼
那咱們一個個來解決:ui
上面2個問題能夠一塊兒解決:spa
echo never >/sys/kernel/mm/transparent_hugepage/enabled
echo never>/sys/kernel/mm/transparent_hugepage/defrag
複製代碼
這個問題就是咱們不能單單把ulimit -n 那個文件句柄數打開,還得同時提高用戶可以使用線程數線程
解決辦法有幾種,這裏介紹一個比較快捷,能夠及時生效的:code
修改 /etc/security/limits.conf 文件,末尾添加:string
* soft noproc 65535
* hard noproc 65535
複製代碼
而後 執行一步 ulimit -u 65535it