MySQL 开启配置binlog以及通过binlog恢复数据
https://blog.csdn.net/weixin_44606481/article/details/133344235
CentoS7 安装篇十二:mysql主从搭建(xtrackbackup不停机搭建)
https://blog.csdn.net/chengxuyuanjava123/article/details/133854966
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#datadir=/srv/mysql
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
server_id=0002
log-bin=mysql-bin
binlog_format=mixed
binlog_do_db=company
/var/lib/mysql
1.2 Xtrabackup 系列版本
目前 Xtrabackup 活跃的大版本有三个:
Xtrabackup 2.4 适用于 MySQL 5.6 和 MySQL 5.7。
Xtrabackup 8.0 适用于 MySQL 8.0。
Xtrabackup 8.1 适用于 MySQL 8.1。
注意,三个版本不能混用,因为 MySQL 8.0 版本 redo log 和数据字典格式都发生了变化,可能会出现不兼容的情况。
- Xtrabackup与mysqldump区别
Xtrabackup属于物理备份,mysqldump属于逻辑备份。
Xtrabackup占用的CPU与内存较少,消耗的IO相对较大,备份后的文件较大。
通过mysql自带的工具mysqldump进行逻辑备份和恢复,虽然可以节省磁盘空间,但是速度很慢。