Comment 3 for bug 1673712

Revision history for this message
Marcelo Altmann (marcelo.altmann) wrote :

I have confirmed this issue:
When we try to increase the open_files_limit on 5.6 it's enough to change /etc/security/limits.conf, but for 5.7 it only gets applied if we change /etc/pam.d/common-session

MYSQL 5.6 with open_files_limit = 1024000 works

-----
root@vagrant-ubuntu-trusty-64:~# /etc/init.d/mysql restart
 * Stopping MySQL (Percona Server) mysqld [ OK ]
 * Starting MySQL (Percona Server) database server mysqld [ OK ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
root@vagrant-ubuntu-trusty-64:~# mysql -u root -e "show variables like '%open_files%';"
+-------------------+---------+
| Variable_name | Value |
+-------------------+---------+
| innodb_open_files | 2000 |
| open_files_limit | 1024000 |
+-------------------+---------+
root@vagrant-ubuntu-trusty-64:~# init 6
root@vagrant-ubuntu-trusty-64:~# Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
marcelo.altmann@bm-support01:~/vagrant/187687$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-117-generic x86_64)
vagrant@vagrant-ubuntu-trusty-64:~$ sudo su -
root@vagrant-ubuntu-trusty-64:~# mysql -u root -e "show variables like '%open_files%';"
+-------------------+---------+
| Variable_name | Value |
+-------------------+---------+
| innodb_open_files | 2000 |
| open_files_limit | 1024000 |
+-------------------+---------+
root@vagrant-ubuntu-trusty-64:~# cat /etc/security/limits.conf

root soft nofile 1048576
root hard nofile 1048576
root hard memlock unlimited
mysql soft nofile 1048576
mysql hard nofile 1048576
mysql hard memlock unlimited

# End of file
-----

Install MySQL 5.7

-----
root@vagrant-ubuntu-trusty-64:~# apt-get remove percona-server-server-5.6
. . .
root@vagrant-ubuntu-trusty-64:~# apt-get install percona-server-server-5.7
 * Percona Server 5.7.18-14 is started
-----

Limits don't get applied on MySQL 5.7

-----

root@vagrant-ubuntu-trusty-64:~# mysql -u root -e "show variables like '%open_files%';"
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| innodb_open_files | 431 |
| open_files_limit | 1024 |
+-------------------+-------+
root@vagrant-ubuntu-trusty-64:~# init 6
root@vagrant-ubuntu-trusty-64:~# Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
marcelo.altmann@bm-support01:~/vagrant/187687$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-117-generic x86_64)
vagrant@vagrant-ubuntu-trusty-64:~$ sudo su -
root@vagrant-ubuntu-trusty-64:~# mysql -u root -e "show variables like '%open_files%';"
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| innodb_open_files | 431 |
| open_files_limit | 1024 |
+-------------------+-------+
root@vagrant-ubuntu-trusty-64:~# cat /etc/security/limits.conf
root soft nofile 1048576
root hard nofile 1048576
root hard memlock unlimited
mysql soft nofile 1048576
mysql hard nofile 1048576
mysql hard memlock unlimited

# End of file

-----

If we change /etc/pam.d/common-session it does

-----
root@vagrant-ubuntu-trusty-64:~# echo "session required pam_limits.so" >> /etc/pam.d/common-session
root@vagrant-ubuntu-trusty-64:~# /etc/init.d/mysql restart
 * Stopping Percona Server 5.7.18-14
...
 * Percona Server 5.7.18-14 is stopped
 * Re-starting Percona Server 5.7.18-14
No directory, logging in with HOME=/
...
 * Percona Server 5.7.18-14 is started
root@vagrant-ubuntu-trusty-64:~# mysql -u root -e "show variables like '%open_files%';"
+-------------------+---------+
| Variable_name | Value |
+-------------------+---------+
| innodb_open_files | 2000 |
| open_files_limit | 1048576 |
+-------------------+---------+
-----