ntopng uses partitioned MySQL tables when storing flows. As MySQL needs a file handle for each partition and its index, it is important to make sure that the open_files_limit
is large enough to allow the process to keep all these files open. Typically, open_files_limit
default value works out-of-the-box but there are some packages/distributions that keeps this number pretty low.
When the current value is too low, ntopng can show errors such as
[MySQLDB.cpp:55] ERROR: MySQL error: Out of resources when opening file './ntopng/flowsv6#P#p23.MYD' (Errcode: 24 - Too many open files) [rc=-1]
The current value can be checked from a MySQL shell
mysql> SHOW VARIABLES LIKE 'open%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 256 | +------------------+-------+ 1 row in set (0.02 sec) mysql>
In order to increase the open_files_limit
it can be necessary to tweak the MySQL configuration file — and, sometimes, also the kernel — to increase it.
To increase that value it is necessary to change the MySQL configuration file adding an entry under [mysqld]
[mysqld] open_files_limit = 1024
Editing the configuration file may not be sufficient. Depending on the OS/platform it can also be necessary to tune the system-wide resources limits using ulimit
.