I have a problem today, MySQL Enterprise backup caused the I/O subsystem load is too large, application response slow, resulting in the system is not available. So I want to limit the mysqlbackup process so that it doesn't cause more problems.
The Mysqlbackup command has a set of read, write, and process numbers. The default is 1 reads, 1 writes, and 5 threads. Because I use the default settings, there is no need to adjust.
Using the Ionice tool does not work because it requires a CFG I/O scheduler.
I found a way in this article. It uses the cgroups of Linux. Before, I used cgroups to test the installation of a galera when one of the three servers was using a very slow CPU.
# Mkdir/cgroup/blkio #
mount-t cgroup-o Blkio Non/cgroup/blkio # cgcreate-g blkio:/mysqlbackup
# LS-LH Dev/mapper/vgdb01-lvdb01
lrwxrwxrwx 1 root 7 Sep 14:22/dev/mapper/vgdb01-lvdb01->. /dm-2
# ls-lh/dev/dm-2
BRW-RW----1 root disk 253, 2 Sep 14:22/dev/dm-2
# cgset-r Blkio.throttle.read_i Ops_device= "253:2" mysqlbackup
# cgset-r blkio.throttle.write_iops_device= "253:2" Mysqlbackup
# echo $$ & Gt /cgroup/blkio/mysqlbackup/tasks
# Cat/proc/$$/cgroup
1:blkio:/mysqlbackup
# mysqlbackup--user= Root--password=xxxxxx--with-timestamp--backup-dir=/data/backup backup
This is a good way to work, exactly as I expected. Both read and write operations are limited to IOPS.
It turned out to be a storage-system problem, so I didn't use it in a production environment, but I hope it helps others. It may also be useful under other issues.