Увеличение лимита open-files-limit в MariaDB on CentOS 7 с помощью systemd

Gone are the days where simply changing /etc/my.cnf would be sufficient. Enter the new systemd world.

systemd itself has a limit that controls how many files a service can open, regardless if what you configure in /etc/my.cnf or /etc/security/limits.conf.

To increase the open files limit in MariaDB running on a RHEL or CentOS 7 with systemd, do the following.

First, create a new directory that will hold the MariaDB service changes in systemd. By making your changes here, you’ll make sure that package upgrades that would/could overwrite the mariadb.service file don’t remove your own changes.

Next, configure systemd so that the MariaDB service can open more files.

In order for systemd to be aware of those changes, you have to reload the systemd daemon. This only reloads the configs that systemd knows about, it does not restart any actual service.

The above tells systemd that MariaDB can open 10000 files of it wants. Restart the MariaDB service now to make those changes stick.

Выполняем запрос к базе данных

Получаем значение

And you’re done.
Increase the value in /etc/systemd/system/mariadb.service.d/limits.conf if needed.

These changes are also «documented» in the mariadb.service service file in systemd.

Just another thing to keep in mind.

Добавить комментарий

Ваш адрес email не будет опубликован.

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.