MariaDB Change Open Files Limit
When using systemctl, you can set value for open_files_limit in my.cnf file.
Default installation of MariaDB 10 have open_files_limit set to 16384.
To increase value for open_files_limit, create file
1 2 |
mkdir /etc/systemd/system/mariadb.service.d/ vi /etc/systemd/system/mariadb.service.d/limitnofile.conf |
Add
1 2 |
[Service] LimitNOFILE=1048576 |
Reload systemctl
1 |
systemctl daemon-reload |
Restart mariadb
1 |
systemctl restart mariadb |
After doing this, it get changed to 32184 instead of 1048576 we specified in limitnofile.conf
To fix this edit
On Cpanel/RHEL
1 |
vi /etc/my.cnf.d/server.cnf |
On Ubuntu/Debian
1 |
vi /etc/mysql/mariadb.conf.d/50-server.cnf |
Under [mysqld], add
1 |
open_files_limit = 102400 |
Now after restarting MariaDB, i get 1048576 for open_files_limit.
This value depends on kernals fs.nr_open parameter. If the value is low, you can increase by editing
1 |
vi /etc/sysctl.conf |
Add
1 |
fs.nr_open=1048576 |
Then make it active with command
1 |
sysctl -p |
To see current value, you can run
1 |
sysctl -a | grep fs.nr_open |
To set the value for the current session, run
1 |
sysctl -w fs.nr_open=1048576 |
Plesk Debian 8 General error: 23 Out of resources when opening
See MySQL