Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solve the problem that the mysql open_files_limit configuration of ubuntu system does not take effect

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Recently took over maintenance of a mysql server, the system is ubuntu 16.04, mysql version 5.7, installation method is apt check mysql configuration parameters found open_files_limit is 1024, a bit small, need to be increased

First, show global status like 'open_files_limit' to see how many files are currently open. At first glance, it is more than 900. Obviously, 1024 is too small and needs to be increased. Therefore, modify/etc/my.cnf to set open_files_limit to 65535, and then/etc/init.d/mysql restart Restart mysql.

After restarting, log in to mysql and use show variables to check that the configuration has not taken effect, or 1024. Check mysq log, original system file description open limit is 1024, less than 65535, mysql think configuration item unreasonable, so use default value 1024, so modify/etc/secruity/limit.conf, add the following two lines

* soft nofile 65535* hard nofile 65535

Log out of the system after modification, make the modification take effect, and restart mysql. He thought that this should have taken effect, but it didn't! A look is still 1024, check mysql log, the previous prompt system file descriptor limit information has been nothing, indicating that the system problem has been solved, there are other restrictions, goole a bit, originally still need to change a place

Modify/lib/systemd/system/mysql.service to add the following two lines

LimitNOFILE=65535LimitMEMLOCK=65535

Then execute the following command to restart mysql

#systemctl daemon-reload#systemctl restart mysqld.service

Problem solved, open_files_limit changed to 65536

Summary: Under ubuntu, there are three conditions for this configuration item to take effect:

1.my.cnf To modify open_files_limit

2. The system open_files_limit value must be greater than or equal to mysql open_files_limit value

3./ lib/systemd/system/mysql.service open_files_limit value to be set is consistent with my.cnf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report