Mongodb start warning: soft rlimits too low

Time:2019-12-7

When mongodb was started today, I didn’t pay attention to it before. Today, I found out that it was warning again. I want to make it whole.

Here are the alarms

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.

Let’s solve it one by one:

transparent_hugepage ,

The above two problems can be solved together:

echo never >/sys/kernel/mm/transparent_hugepage/enabled

echo never>/sys/kernel/mm/transparent_hugepage/defrag

soft rlimits too low

The problem is that we can not only open ulimit-n file handle number, but also increase the number of threads available to users

There are several solutions. Here is a quick and effective one:

Modify the file / etc / security / limits.conf, and add:

* soft noproc 65535
* hard noproc 65535

Then take a step ulimit – U 65535

  • The first step is to make the process permanent
  • The second step is to make the current session take effect immediately