CloudLinux 7 MySql open_files_limit and max_open_files setup

 

CentOS 7 was released on 7 July 2014 with new systemd format. As the Systemd now replaces SysVinit, it is time to get familiar with it.

With new Systemd in CloudLinux 7 – comes new problems that need to be fixed and solved 🙂

The problem

When you try to change open_files_limit and max_open_files in /etc/my.cnf , the setting in my.cnf ignored completely.

My system is : CloudLinux 7.2 , cPanel v.56 with CageFS, PHPselector, DB_governor, LSPHP.

You can try to see thous settings in mysql with this command , you will see the same numbers as before.

 

My my.cnf

My mysql server logs:

A little about CloudLinux 7

CloudLinux OS is an operating system designed specifically for shared hosting providers, developed by computer software company CloudLinux Inc. CloudLinux OS is based on OpenVZ kernel and is fully compatible with CentOS/RHEL packages. CloudLinux OS is designed to improve stability and security on server and to optimize its work on account of isolating tenants on server, setting resource usage limits for them, optimizing work with databases etc.

 

Possible solution – not helped me 🙁

You can try to change LimitNOFILE option in /usr/lib/systemd/system/mysqld.service  .

Then run:

 

Copy of the mysqld.service file :

Following links might be helpful:
http://dba.stackexchange.com/questions/86987/mysql-open-files-limit-cannot-change-this-variable
https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/

 

 

Solution to the problem – THE fix

I have found a solution to edit /usr/lib/systemd/system/mysqld.service and add there:

Those options has been set in it however in [Install] section. I moved them to [Service] section and after “systemctl daemon-reload” and “systemctl restart mysql.service” the value has been applied properly:

After that change , my.cnf will have full control to open_files_limit and max_open_files and you can successfully change it there and of course restart mysql service after the change.

Things become more complicated with systemd now, looks like that is only one right way to set open_files_limit for mysql now.

However that is a way CentOS7/RHEL7/CloudLinux7 works with new systemd 🙁

 

Letter from cPanel team

 

Thanks to CloudLinux and cPanel teams (and to Sergey Babkevych meeee:)) ) that take participation in that cooperative investigation, research and testing.

Good luck!