mariadbがファイルを検出したとき、mysqldumpを使用してデータベースをバックアップすると、mysqldump:Got error:1016: "Ca n't open file: './ testxxx / table1.frm'(errno:24)" when using LOCKTABLESも同様です。このエラーに対して、一般的な解決策は、/ etc /my.cnf構成ファイルにパラメーターopen_files_limit = 10240を追加してから、データベースサービスを再起動することです。ただし、mariadbがこれを行った後、データベースにログインし、「%open%」などのコマンドshowvariablesを使用します。確認するときはデフォルトの1024がデフォルトのままであるため、要件を満たしていません。変更する2つの方法は次のとおりです。オープンファイルの制限。
设置说明:
#cat /usr/lib/systemd/system/mariadb.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
# .include /lib/systemd/system/mariadb.service
# ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# For example, if you want to increase mariadb's open-files-limit to 10000,
# you need to increase systemd's LimitNOFILE setting, so create a file named
# "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
# [Service]
# LimitNOFILE=10000
# Note: /usr/lib/... is recommended in the .include line though /lib/...
# still works.
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload
方式一:
#创建目录,新建配置文件
mkdir -p /etc/systemd/system/mariadb.service.d/
vim /etc/systemd/system/mariadb.service.d/limits.conf
[Service]
LimitNOFILE=10240
systemctl daemon-reload
systemctl restart mariadb
验证:show global variables like 'open_files_limit';
方式二:
直接编辑/usr/lib/systemd/system/mariadb.service
[Service]
Type=simple
User=mysql
Group=mysql
LimitNOFILE=10240
systemctl daemon-reload
systemctl restart mariadb
验证:show global variables like 'open_files_limit';