[[email protected] ~]# mkdir xtrabakup
[[email protected] ~]# cd xtrabakup/
[[email protected] xtrabakup]# wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.22/binary/redhat/8/x86_64/Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar
--2021-05-09 13:04:32-- https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.22/binary/redhat/8/x86_64/Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar
正在解析主机 downloads.percona.com (downloads.percona.com)... 162.220.4.222
正在连接 downloads.percona.com (downloads.percona.com)|162.220.4.222|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:76595200 (73M) [application/x-tar]
正在保存至: “Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar”
Percona-XtraBackup- 100%[==================>] 73.05M 3.38MB/s 用时 84s
2021-05-09 13:05:57 (893 KB/s) - 已保存 “Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar” [76595200/76595200])
[[email protected] xtrabakup]# ls
Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar
解压并且安装
[[email protected] xtrabakup]# tar xf Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar
[[email protected] xtrabakup]# ls
Percona-XtraBackup-2.4.22-rc99a781-el8-x86_64-bundle.tar
percona-xtrabackup-24-2.4.22-1.el8.x86_64.rpm
percona-xtrabackup-24-debuginfo-2.4.22-1.el8.x86_64.rpm
percona-xtrabackup-24-debugsource-2.4.22-1.el8.x86_64.rpm
percona-xtrabackup-test-24-2.4.22-1.el8.x86_64.rpm
percona-xtrabackup-test-24-debuginfo-2.4.22-1.el8.x86_64.rpm
[[email protected] xtrabakup]# dnf -y install percona-xtrabackup-24-2.4.22-1.el8.x86_64.rpm
CentOS
将mysql的套接字文件连接到/var/lib/mysql/mysql.sock
[[email protected] ~]# mkdir /var/lib/mysql
[[email protected] ~]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[[email protected] ~]# cd /var/lib/mysql
[[email protected] mysql]# ls
mysql.sock
首先创建存放备份数据的目录
[[email protected] ~]cd /
[[email protected] /]# mkdir backups
[[email protected] /]# cd backups/
[[email protected] backup]# mkdir all
[[email protected] backup]# mkdir all1
[[email protected] backup]# mkdir all2
将密码写入配置文件
[[email protected] backup]# cat ~/.my.cnf
[client]
user=root
password=Czh1.com
[innobaukupex]
user=root
password=Czh1.com
首先查看数据库里有什么
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| chenzihan |
| czh |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.01 sec)
进行全备
mysql> select * from czh.student;
+----+-------------+------+
| id | name | age |
+----+-------------+------+
| 1 | tom | 20 |
| 2 | jerry | 23 |
| 3 | wangqing | 25 |
| 4 | sean | 28 |
| 5 | zhangshan | 26 |
| 7 | lisi | 50 |
| 8 | chenshuo | 10 |
| 9 | wangwu | 100 |
| 10 | qiuyi | 15 |
| 11 | qiuxiaotian | 20 |
+----+-------------+------+
10 rows in set (0.00 sec)
在进行全备
[[email protected] /]# xtrabackup --backup --target-dir /backups/all/
xtrabackup: recognized server arguments: --datadir=/opt/mysql_data
xtrabackup: recognized client arguments: --user=root --password=* --backup=1 --target-dir=/backups/all/
210509 13:45:27 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
210509 13:45:27 version_check Connected to MySQL server
210509 13:45:27 version_check Executing a version check against the server...
210509 13:45:27 version_check Done.
···········
···········
210509 13:45:28 [00] ...done
xtrabackup: Transaction log of lsn (2835743) to (2835752) was copied.
210509 13:45:29 completed OK!
[[email protected] /]# cd backups/
[[email protected] backups]# ls
all all1 all2
[[email protected] backups]# ll all
总用量 12336
-rw-r-----. 1 root root 487 5月 9 13:45 backup-my.cnf
drwxr-x---. 2 root root 58 5月 9 13:45 chenzihan
drwxr-x---. 2 root root 58 5月 9 13:45 czh
-rw-r-----. 1 root root 362 5月 9 13:45 ib_buffer_pool
-rw-r-----. 1 root root 12582912 5月 9 13:45 ibdata1
drwxr-x---. 2 root root 4096 5月 9 13:45 mysql
drwxr-x---. 2 root root 8192 5月 9 13:45 performance_schema
drwxr-x---. 2 root root 8192 5月 9 13:45 sys
-rw-r-----. 1 root root 135 5月 9 13:45 xtrabackup_checkpoints
-rw-r-----. 1 root root 417 5月 9 13:45 xtrabackup_info
-rw-r-----. 1 root root 2560 5月 9 13:45 xtrabackup_logfile
在表中添加数据
mysql> use czh;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> insert into student(name,age) values('tommao',10);
Query OK, 1 row affected (0.01 sec)
mysql> select * from student;
+----+-------------+------+
| id | name | age |
+----+-------------+------+
| 1 | tom | 20 |
| 2 | jerry | 23 |
| 3 | wangqing | 25 |
| 4 | sean | 28 |
| 5 | zhangshan | 26 |
| 7 | lisi | 50 |
| 8 | chenshuo | 10 |
| 9 | wangwu | 100 |
| 10 | qiuyi | 15 |
| 11 | qiuxiaotian | 20 |
| 12 | tommao | 10 |
+----+-------------+------+
11 rows in set (0.00 sec)
在全备的基础上进行增备
[[email protected] /]# xtrabackup --backup --target-dir /backups/all1/ --incremental-basedir /backups/all/
xtrabackup: recognized server arguments: --datadir=/opt/mysql_data
xtrabackup: recognized client arguments: --user=root --password=* --backup=1 --target-dir=/backups/all1/ --incremental-basedir=/backups/all/
············
············
210509 13:54:17 completed OK!
[[email protected] /]# ll backups/all1
总用量 148
-rw-r-----. 1 root root 487 5月 9 13:54 backup-my.cnf
drwxr-x---. 2 root root 88 5月 9 13:54 chenzihan
drwxr-x---. 2 root root 88 5月 9 13:54 czh
-rw-r-----. 1 root root 362 5月 9 13:54 ib_buffer_pool
-rw-r-----. 1 root root 98304 5月 9 13:54 ibdata1.delta
-rw-r-----. 1 root root 60 5月 9 13:54 ibdata1.meta
drwxr-x---. 2 root root 4096 5月 9 13:54 mysql
drwxr-x---. 2 root root 8192 5月 9 13:54 performance_schema
drwxr-x---. 2 root root 8192 5月 9 13:54 sys
-rw-r-----. 1 root root 139 5月 9 13:54 xtrabackup_checkpoints
-rw-r-----. 1 root root 460 5月 9 13:54 xtrabackup_info
-rw-r-----. 1 root root 2560 5月 9 13:54 xtrabackup_logfile
再次插入数据
mysql> use czh;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> insert into student(name,age) values('jerrylaosu',10);
Query OK, 1 row affected (0.00 sec)
mysql> select * from student;
+----+-------------+------+
| id | name | age |
+----+-------------+------+
| 1 | tom | 20 |
| 2 | jerry | 23 |
| 3 | wangqing | 25 |
| 4 | sean | 28 |
| 5 | zhangshan | 26 |
| 7 | lisi | 50 |
| 8 | chenshuo | 10 |
| 9 | wangwu | 100 |
| 10 | qiuyi | 15 |
| 11 | qiuxiaotian | 20 |
| 12 | tommao | 10 |
| 13 | jerrylaosu | 10 |
+----+-------------+------+
12 rows in set (0.00 sec)
进行第二次增备
[[email protected] /]# xtrabackup --backup --target-dir /backups/all2/ --incremental-basedir /backups/all1/
210509 14:01:10 completed OK!
[[email protected] /]# ll backups/all2
总用量 116
-rw-r-----. 1 root root 487 5月 9 14:01 backup-my.cnf
drwxr-x---. 2 root root 88 5月 9 14:01 chenzihan
drwxr-x---. 2 root root 88 5月 9 14:01 czh
-rw-r-----. 1 root root 362 5月 9 14:01 ib_buffer_pool
-rw-r-----. 1 root root 65536 5月 9 14:01 ibdata1.delta
-rw-r-----. 1 root root 60 5月 9 14:01 ibdata1.meta
drwxr-x---. 2 root root 4096 5月 9 14:01 mysql
drwxr-x---. 2 root root 8192 5月 9 14:01 performance_schema
drwxr-x---. 2 root root 8192 5月 9 14:01 sys
-rw-r-----. 1 root root 139 5月 9 14:01 xtrabackup_checkpoints
-rw-r-----. 1 root root 461 5月 9 14:01 xtrabackup_info
-rw-r-----. 1 root root 2560 5月 9 14:01 xtrabackup_logfile
[[email protected] /]#
误删数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| chenzihan |
| czh |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql> drop database czh;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| chenzihan |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
防止全备和增量备份日志回滚(最后一次的增量备份除外)
[[email protected] backups]# xtrabackup --prepare --apply-log-only --target-dir /backups/all/
[[email protected] backups]# xtrabackup --prepare --apply-log-only --target-dir /backups/all/ --incremental-dir /backups/all1/
防止最后一次的增量备份回滚
[[email protected] backups]# xtrabackup --prepare --target-dir /backups/all/ --incremental-dir /backups/all2
[[email protected] backups]# cat all/xtrabackup_checkpoints
backup_type = full-prepared
from_lsn = 0
to_lsn = 2836111
last_lsn = 2836120
compact = 0
recover_binlog_info = 0
flushed_lsn = 2836120
[[email protected] backups]# cat all1/xtrabackup_checkpoints
backup_type = incremental
from_lsn = 2835743
to_lsn = 2835917
last_lsn = 2835926
compact = 0
recover_binlog_info = 0
flushed_lsn = 2835926
[[email protected] backups]# cat all2/xtrabackup_checkpoints
backup_type = incremental
from_lsn = 2835917
to_lsn = 2836111
last_lsn = 2836120
compact = 0
recover_binlog_info = 0
flushed_lsn = 2836120
恢复数据库
[[email protected] ~]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[[email protected] ~]# rm -rf /opt/mysql_data/*
[[email protected] ~]# xtrabackup --copy-back --target-dir /backups/all/xtrabackup: recognized server arguments: --datadir=/opt/mysql_data
210509 14:11:19 completed OK!
[[email protected] ~]# chown -R mysql.mysql /opt/mysql_data/
[[email protected] ~]# ll /opt/mysql_data/
总用量 122920
drwxr-x---. 2 mysql mysql 58 5月 9 14:11 chenzihan
drwxr-x---. 2 mysql mysql 58 5月 9 14:11 czh
-rw-r-----. 1 mysql mysql 362 5月 9 14:11 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 5月 9 14:11 ibdata1
-rw-r-----. 1 mysql mysql 50331648 5月 9 14:11 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 5月 9 14:11 ib_logfile1
-rw-r-----. 1 mysql mysql 12582912 5月 9 14:11 ibtmp1
drwxr-x---. 2 mysql mysql 4096 5月 9 14:11 mysql
drwxr-x---. 2 mysql mysql 8192 5月 9 14:11 performance_schema
drwxr-x---. 2 mysql mysql 8192 5月 9 14:11 sys
-rw-r-----. 1 mysql mysql 461 5月 9 14:11 xtrabackup_info
-rw-r-----. 1 mysql mysql 1 5月 9 14:11 xtrabackup_master_key_id
[[email protected] ~]# service mysqld start
Starting MySQL.Logging to '/opt/mysql_data/czh.err'.
. SUCCESS!
[[email protected] ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.33 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from czh.student;
+----+-------------+------+
| id | name | age |
+----+-------------+------+
| 1 | tom | 20 |
| 2 | jerry | 23 |
| 3 | wangqing | 25 |
| 4 | sean | 28 |
| 5 | zhangshan | 26 |
| 7 | lisi | 50 |
| 8 | chenshuo | 10 |
| 9 | wangwu | 100 |
| 10 | qiuyi | 15 |
| 11 | qiuxiaotian | 20 |
| 12 | tommao | 10 |
| 13 | jerrylaosu | 10 |
+----+-------------+------+
12 rows in set (0.01 sec)
WaitForSingleObject 的用法 DWORDWaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds );参数 hHandle 是一个事件的句柄,第二个参数 dwMillise
DS-SLAM总结编译caffe-segnet-cudnn5编译编译caffe-segnet-cudnn5编译该库的编译与caffe一样,其中的Makefile.config文件和Makefile文件都需要进行配置参考教程caffe-segnet-cudnn5的编译安装,其需要cuda8.0和cudnn5,且需要gpu需要支持compute_20在cuda9.0和cudnn7.0.5的...
提示在可以调用OLE之前,必须将当前线程设置为单线程单元(STA)模式,请确保您的Main函数带有STAThreadAttribute导入导出功能,在调用ShowDialog时的错误,解决办法如下:WinForm窗体的入口点: /// <summary> /// 应用程序的主入口点加入 [STAThread]。 /// </summary> [STAThread] private stat
解决微信小程序input框 placeholder 换行textarea,wechat小程序 textarea的placeholder如何换行,vant-weapp 组件库 Field 输入框组件 van-field 的placehold怎么换行?,微信小程序中如何设置textarea中的placeholder换行显示,css input输入框placeholder样式的修改,怎么让textarea的灰色placeholder换行显示描述呢,微信小程序 - textarea 多行文本输入框 placehol
海康威视摄像头,绕过萤石云并发限制,自由拓展
1、创建目录mkdir; 递归创建目录 mkdir -p hunan/changde[[email protected] ~]# lsanaconda-ks.cfg install.log install.log.syslog japan[roo[email protected] ~]# mkdir hunan[[email protected] ~]# lsanaconda-ks.cfg
matplotlib学习笔记-axis.labelpad是什么意思,有什么用?坐标轴标签的位置坐标!
星际争霸2:强化学习新挑战原文下载链接:https://deepmind.com/documents/110/sc2le.pdf本文绿色字体是学习过程中的注释,蓝色字体为总结,可以忽略,最后附有个人翻译后记。整个论文分为:摘要(Abstract)1.介绍(Introduction)2.相关工作(Related work)3.sc2le环境(The SC2LE Environment)...
本人菜鸟,初学模糊控制器,为了方便以后查阅写此博文,欢迎初学者借鉴,高手指点!环境:MATLAB R2012a目录一、设计模糊控制器1.1 创建项目文件夹1.2 打开MATLAB 1.3 设计模糊控制器二、设置控制系统三、simulink仿真一、设计模糊控制器1.1 创建项目文件夹在此路径如图1.2 打开MATLAB打开MATLAB R201...
点击上方蓝色“java大数据修炼之道”,选择“设为星标”每晚九点: 技术干货 ???? 必定奉上哈喽,各位新来的小伙伴们,大家好!由于公众号做了改版,为了保证公众号的资源能准时推送到你...
总结1:周志华 || AI领域如何做研究-写高水平论文总结2:全网首发最全深度强化学习资料(永更)总结3:《强化学习导论》代码/习题答案大全总结4:30+个必知的《人工智能》会议清单总...
在传输原语中, LISTEN 是一个阻塞调用。试问这是严格要求的吗?如果不是,请解释如何使用一个非阻塞的原语。与正文中描述的方案相比,你的方案有什么优点?解:不是。LISTEN可能表示愿意建立新的连接,而不是阻止。当尝试连接时,可以给调用者一个信号。然后,它将执行,例如,OK或REJECT接受或拒绝连接。传输服务原语假设在两个端点之间建立连接的过程是不对称的,一端(服务器〉执行LIST...