Mysqldump备份问题

1.1 Mysqldump文件数打开过多

mysql> mysqldump -uroot -p131400 --all-databases >/backup/mysql.sql
mysqldump:Goterror:1105:File’./db/data_20070901.MYD’notfound(Errcode:24)whenusingLOCKTABLES

解决方法:

登陆数据库查看最大文件打开数为多少

mysql> show variables like '%open%';
+----------------------------+----------+
| Variable_name              | Value    |
+----------------------------+----------+
| have_openssl               | DISABLED |
| innodb_open_files          | 2000     |      
| open_files_limit           | 5000     |        这个为5000
| table_open_cache           | 2000     |
| table_open_cache_instances | 1        |
+----------------------------+----------+
5 rows in set (0.00 sec)

mysql配置文件中/etc/my.cnf中添加open_files_limit = 65535重启数据库,如果还不生效,那就修改数据库的启动脚本

vim /etc/systemd/system/mysql.service
在mysql.service中添加
[Service]
User=mysq
Group=mysql
LimitNOFILE=65535  #新加入的内容 添加在最后一行

重启服务,修改了mysql.server有可能需要

systemctl daemon-reload

修改系统配置文件/etc/security/limits.conf  

* soft nofile 65535
* hard nofile 65535

登陆数据库查看

mysql> show variables like '%open%';
+-------------------+----------+
| Variable_name     | Value    |
+-------------------+----------+
| have_openssl      | DISABLED |
| innodb_open_files | 300      |
| open_files_limit  | 65535    |   已经变为65535
| table_open_cache  | 512      |
+-------------------+----------+
4 rows in set (0.00 sec)

 

posted @ 2018-10-31 16:59  Belief°  阅读(312)  评论(0编辑  收藏  举报