MariaDB: Could not increase number of max_open_files to more than 1024

Mamy problem, a raczej ostrzeżenie.

mysqld[776]: 2019-10-04 11:39:53 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 4186)
mysqld[776]: 2019-10-04 11:39:53 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)

Jak sprawdzić aktualną wartość max_open_files ?

SHOW VARIABLES LIKE 'open_files_limit';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 1024  |
+------------------+-------+

Procedura naprawy wygląda następująco.

cp /usr/lib/systemd/system/mariadb.service /etc/systemd/system
mkdir /etc/systemd/system/mariadb.service.d/
nano /etc/systemd/system/mariadb.service.d/limits.conf
cd /etc/systemd/system/mariadb.service.d/
echo "[Service]" >> limits.conf
echo "LimitNOFILE=4186" >> limits.conf
systemctl daemon-reload
systemctl restart mariadb

Werifikujemy w logach czy nie ma żadnych ostrzeżeń lub błędów. Sprawdzamy obecną wartość max_open_files

SHOW VARIABLES LIKE 'open_files_limit';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 4186  |
+------------------+-------+

Leave a comment

Your email address will not be published. Required fields are marked *