MySQL/MariaDB [Warning] Could not increase number of max_open_files to more than 32768 (request: 100000)
Seeing the warning recently on a number of VMs running MySQL/MariaDB.
[Warning] Could not increase number of max_open_files to more than 32768 (request: 100000)
A MariaDB process has requested a larger amount of open files, you can verify the current limit by starting a mysql session on your server and adding on the command line:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 7706 Server version: 10.6.14-MariaDB-1:10.6.14+maria~ubu2204 mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> SHOW VARIABLES LIKE 'open_files_limit'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 32768 | +------------------+-------+ 1 row in set (0.002 sec)
The limit is calculated by max_connections and table_open_cache and set by the value of LimitNOFILE
LimitNOFILE=100000
Create a conf file named mdbextras.conf in /etc/systemd/system/mariadb.service.d, you can name it what you like but prepend .conf
nano /etc/systemd/system/mariadb.service.d/mdbextras.conf
Add in the file:
[Service]
LimitNOFILE=100000
Save and quit, then reload the daemon:
systemctl daemon-reload
Then restart mariadb:
systemctl restart mariadb
Job done, no more warnings.