3 ms·
Backup and Compress a MySQL Database With One Command
- Nanzikambe 12y agoDoing it that way will rape disk I/O on your server, much better use ZFS snapshot then just zfs send & pipe thru xz/bzip2 to send it remotely Example: #!/bin/bash TS=$(date "+%Y%m%d-%H%M%S") SNAP=zpool/mysql@${TS} zfs snapshot $SNAP zfs send $SNAP | pv | xz -z | ssh somewhere "cat > /mnt/snapshots/mysql-${TS}.xz" zfs destroy -Rv $SNAP Assumes that your /var/lib/mysql is zpool/mysql ofc
- tlongren 12y agoAwesome tip Nanzikambe! I'll update with your more disk I/O friendly solution.
- morgo 12y agoI would say that the biggest risk with mysqldump is restore time. If a significant portion of the buffer pool is in memory, it may actually dump quite fast. MySQL 5.5 and above also have a modified LRU algorithm so that tablescans (i.e. mysqldump) can only evict up to 3/8ths of the cache contents.