MariaDB Backup Process

Steps to resolve "Too Many Open Files" issue during MariaDB backup using mariabackup.

1. Verify and Increase File Descriptor Limits

Check the current limit on open file descriptors:

ulimit -n

If the limit is too low, increase it:

ulimit -n 65536

2. Increase Limits System-Wide

Edit /etc/security/limits.conf:

*    soft    nofile    65536
*    hard    nofile    65536

Edit the systemd service configuration:

sudo mkdir -p /etc/systemd/system/mariadb.service.d/
sudo nano /etc/systemd/system/mariadb.service.d/limits.conf

Add:

[Service]
LimitNOFILE=65536

Reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart mariadb

3. Adjust innodb_open_files Parameter

Check current value:

mysql -u root -p -e "SHOW VARIABLES LIKE 'innodb_open_files';"

If needed, add to [mysqld] section:

innodb_open_files=65536

4. Clean Up and Run Backup

Ensure backup directory is empty:

rm -rf /mnt/datavol2/backups/*

Run backup:

mariabackup --backup --target-dir=/mnt/datavol2/backups --datadir=/mnt/datavol2/mariadb