MySQL5.7热备份-xtrabackup
发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,热备份1 xtrabackup下载wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.9/binary/t
千家信息网最后更新 2025年02月04日MySQL5.7热备份-xtrabackup
热备份
1 xtrabackup下载
wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.9/binary/tarball/percona-xtrabackup-2.4.9-Linux-x86_64.tar.gz[root@Master_test ~]# lltotal 88192-rw-------. 1 root root 1201 Feb 16 2017 anaconda-ks.cfg-rw-r--r--. 1 root root 9913 Feb 16 2017 install.log-rw-r--r--. 1 root root 3161 Feb 16 2017 install.log.syslog-rw-r--r--. 1 root root 90282874 Nov 23 2017 percona-xtrabackup-2.4.9-Linux-x86_64.tar.gz
2 目录结构
[root@Master_test bin]# lltotal 212008lrwxrwxrwx. 1 root root 10 Jul 6 23:21 innobackupex -> xtrabackup-rwxr-xr-x. 1 root root 5357661 Nov 23 2017 xbcloud-rwxr-xr-x. 1 root root 3020 Nov 23 2017 xbcloud_osenv-rwxr-xr-x. 1 root root 5270021 Nov 23 2017 xbcrypt-rwxr-xr-x. 1 root root 5344286 Nov 23 2017 xbstream-rwxr-xr-x. 1 root root 201111701 Nov 23 2017 xtrabackup[root@Master_test bin]# pwd/root/percona-xtrabackup-2.4.9-Linux-x86_64/bin[root@Master_test bin]#
说明:
innobackupex 是要使用的备份工具
xtrabackup是被封装在innobackupex之中,,innobackupex运行时需要调用它。
3 创建测试数据库和表
root@Master 23:59: [(none)]> create database db1;Query OK, 1 row affected (0.08 sec)root@Master 23:59: [(none)]> use db1Database changedroot@Master 23:59: [db1]> root@Master 23:59: [db1]> create table t1(id int,name varchar(20));Query OK, 0 rows affected (0.08 sec)root@Master 00:00: [db1]> desc t1;+-------+-------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+-------------+------+-----+---------+-------+| id | int(11) | YES | | NULL | || name | varchar(20) | YES | | NULL | |+-------+-------------+------+-----+---------+-------+root@Master 00:00: [db1]> root@Master 00:00: [db1]> insert into t1(id, name) values(1,'zhangsan');Query OK, 1 row affected (0.00 sec)root@Master 00:01: [db1]> insert into t1(id, name) values(2,'lisi');Query OK, 1 row affected (0.00 sec)root@Master 00:01: [db1]> insert into t1(id, name) values(3,'wangwu');Query OK, 1 row affected (0.00 sec)root@Master 00:01: [db1]> select * from t1;+------+----------+| id | name |+------+----------+| 1 | zhangsan || 2 | lisi || 3 | wangwu |+------+----------+3 rows in set (0.00 sec)
4 全量备份
1)执行报错
[root@Master_test bin]# ./innobackupex --user=root --password-root --defaults-file=/etc/my.cnf /bak./innobackupex: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./innobackupex)'
2)解决错误
呈现该错误的原因是当前的GCC版本中,没有GLIBCXX_3.4.15,须要安装更高版本
[root@Master_test bin]# strings /usr/lib64/libstdc++.so.6 | grep GLIBCXXGLIBCXX_3.4GLIBCXX_3.4.1GLIBCXX_3.4.2GLIBCXX_3.4.3GLIBCXX_3.4.4GLIBCXX_3.4.5GLIBCXX_3.4.6GLIBCXX_3.4.7GLIBCXX_3.4.8GLIBCXX_3.4.9GLIBCXX_3.4.10GLIBCXX_3.4.11GLIBCXX_3.4.12GLIBCXX_3.4.13GLIBCXX_FORCE_NEWGLIBCXX_DEBUG_MESSAGE_LENGTH
可见没有GLIBCXX_3.4.15.
3)下载libstdc
新版本,地址:
32bit
http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_i386.deb
64bit
http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb
4)安装libstdc
[root@Master_test ~]# wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6_4.7.2-5_amd64.deb解压:[root@Master_test ~]# ar -x libstdc++6_4.7.2-5_amd64.deb && tar xvf data.tar.gz./usr/./usr/share/./usr/share/doc/./usr/lib/./usr/lib/x86_64-linux-gnu/./usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17./usr/share/doc/libstdc++6./usr/lib/x86_64-linux-gnu/libstdc++.so.6
5)安装步骤
切到解决后的目录,把libstdc++.so.6.0.17拷贝到系统的/usr/lib64下,然后删除原libstdc++.so.6,把libstdc++.so.6.0.17,软链接为libstdc++.so.6。
cd /root/usr/lib/x86_64-linux-gnu[root@Master_test x86_64-linux-gnu]# lltotal 972lrwxrwxrwx. 1 root root 19 Jul 7 01:18 libstdc++.so.6 -> libstdc++.so.6.0.17-rw-r--r--. 1 root root 991600 Jan 7 2013 libstdc++.so.6.0.17cp libstdc++.so.6.0.17 /usr/lib64cd /usr/lib64rm libstdc++.so.6ln libstdc++.so.6.0.17 libstdc++.so.6检查一下[root@Master_test x86_64-linux-gnu]# strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX GLIBCXX_3.4GLIBCXX_3.4.1GLIBCXX_3.4.2GLIBCXX_3.4.3GLIBCXX_3.4.4GLIBCXX_3.4.5GLIBCXX_3.4.6GLIBCXX_3.4.7GLIBCXX_3.4.8GLIBCXX_3.4.9GLIBCXX_3.4.10GLIBCXX_3.4.11GLIBCXX_3.4.12GLIBCXX_3.4.13GLIBCXX_3.4.14GLIBCXX_3.4.15GLIBCXX_3.4.16GLIBCXX_3.4.17GLIBCXX_DEBUG_MESSAGE_LENGTH已经有了GLIBCXX_3.4.15。
5 执行全量备份
--user:连接数据库的用户名
--password:连接数据的密码
--defaults-file:配置文件(必须放在最前面,否则会报错)
/bak:备份文件的位置
[root@Master_test bin]# ./innobackupex --defaults-file=/etc/my.cnf --user=root --password=root /bak180707 01:28:04 innobackupex: Starting the backup operationIMPORTANT: Please check that the backup run completes successfully. At the end of a successful backup run innobackupex prints "completed OK!".180707 01:28:04 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock' as 'root' (using password: YES).Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327.180707 01:28:04 Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /tmp/mysql.sockUsing server version 5.7.22-log./innobackupex version 2.4.9 based on MySQL server 5.7.13 Linux (x86_64) (revision id: a467167cdd4)xtrabackup: uses posix_fadvise().xtrabackup: cd to /data/mysql/mysql3306/dataxtrabackup: open files limit requested 65535, set to 65535xtrabackup: using the following InnoDB configuration:xtrabackup: innodb_data_home_dir = .xtrabackup: innodb_data_file_path = ibdata1:1G:autoextendxtrabackup: innodb_log_group_home_dir = ./xtrabackup: innodb_log_files_in_group = 2xtrabackup: innodb_log_file_size = 1073741824xtrabackup: using O_DIRECTInnoDB: Number of pools: 1180707 01:28:05 >> log scanned up to (2597729)xtrabackup: Generating a list of tablespacesInnoDB: Allocated tablespace ID 24 for db1/t1, old maximum was 0180707 01:28:05 [01] Copying ./ibdata1 to /bak/2018-07-07_01-28-04/ibdata1180707 01:28:06 >> log scanned up to (2597729)180707 01:28:07 >> log scanned up to (2597729)180707 01:28:08 >> log scanned up to (2597729)省略中间信息*****************************************************************180707 01:28:45 [01] Copying ./sys/statements_with_sorting.frm to /bak/2018-07-07_01-28-04/sys/statements_with_sorting.frm180707 01:28:45 [01] ...done180707 01:28:45 [01] Copying ./sys/x@0024ps_digest_95th_percentile_by_avg_us.frm to /bak/2018-07-07_01-28-04/sys/x@0024ps_digest_95th_percentile_by_avg_us.frm180707 01:28:45 [01] ...done180707 01:28:45 >> log scanned up to (2597729)180707 01:28:45 [01] Copying ./sys/x@0024wait_classes_global_by_avg_latency.frm to /bak/2018-07-07_01-28-04/sys/x@0024wait_classes_global_by_avg_latency.frm180707 01:28:45 [01] ...done180707 01:28:45 Finished backing up non-InnoDB tables and files180707 01:28:45 [00] Writing /bak/2018-07-07_01-28-04/xtrabackup_binlog_info180707 01:28:45 [00] ...done180707 01:28:45 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...xtrabackup: The latest check point (for incremental): '2597720'xtrabackup: Stopping log copying thread..180707 01:28:45 >> log scanned up to (2597729)180707 01:28:46 Executing UNLOCK TABLES180707 01:28:46 All tables unlocked180707 01:28:46 [00] Copying ib_buffer_pool to /bak/2018-07-07_01-28-04/ib_buffer_pool180707 01:28:46 [00] ...done180707 01:28:46 Backup created in directory '/bak/2018-07-07_01-28-04/'MySQL binlog position: filename 'mybinlog.000003', position '1311', GTID of the last change 'fe259816-8122-11e8-ab02-000c29fa3266:1-6'180707 01:28:46 [00] Writing /bak/2018-07-07_01-28-04/backup-my.cnf180707 01:28:46 [00] ...done180707 01:28:46 [00] Writing /bak/2018-07-07_01-28-04/xtrabackup_info180707 01:28:46 [00] ...donextrabackup: Transaction log of lsn (2597720) to (2597729) was copied.180707 01:28:46 completed OK!
备份
数据
数据库
文件
版本
目录
错误
之中
位置
信息
原因
地址
备份工具
密码
工具
拷贝
步骤
用户
用户名
系统
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
什么软件能导入手机数据库
国家软件开发
松下大连软件开发电器
修改数据库的语句
记录网络安全行为水粉画
网络安全行业有什么职位
软件开发工作如何与同事配合
vncviewer服务器怎么填
网络安全技术开发中心
软件开发大学四年都在学什么
如何找到时空猎人服务器
无现金社会网络安全
异地双活数据库同步异常
两当县网络安全宣传片
网络安全ca
无线局域网网络技术有哪些
服务器机柜生产投资测算
服务器c5和s6
黄浦区一站式软件开发品质保障
一项网络技术如何买卖
中国数据库技术大会
北京工行软件开发部地址
怎么插入数据库自动生成编号
mac写入数据库文件夹失败
vncviewer服务器怎么填
一个国家如果软件开发能力强
厦门轨道线路数据库设计主要内容
聚橙网络技术公司怎么样
自己搭建微信服务器
互联网 是抗疫黑科技吗