当前位置: 首页 > news >正文

24 Linux高级篇-备份与恢复

24 Linux高级篇-备份与恢复

文章目录

  • 24 Linux高级篇-备份与恢复
    • 24.1 安装dump和restore
    • 24.2 使用dump备份
    • 24.4 使用restore恢复

  • 学习视频来自于B站【小白入门 通俗易懂】2021韩顺平 一周学会Linux。
  • 可能会用到的资料有如下所示,下载链接见文末:
  1. 《鸟哥的Linux私房菜 基础学习篇 第四版》1
  2. 《鸟哥的Linux私房菜 服务器架设篇 第三版》2
  3. 《韩顺平_2021图解Linux全面升级》3

24.1 安装dump和restore

  在学习Linux的过程中,我们一直用VMware新建虚拟机来进行开发,并且即使有rm -rf /*之类的骚操作也可以使用“快照”来进行恢复。但在工作环境下,实体机无法做快照,如果出现严重的异常或者数据损坏,甚至要重做系统,就会造成数据丢失,所以我们就需要“备份和恢复”。linux的备份和恢复很简单,有两种方式:

  1. 把需要的文件(或者分区)用tar指令打包,下次需要恢复的时候,再解压开覆盖即可。
  2. 使用dumprestore命令——dump指令备份、restore指令还原。

注:备份的重要数据时应上传到其他服务器,不要将所有数据都放在一台机器上。
注:dump指令配合crontab定时调度指令显然可以实现无人值守备份。

还原后的/opt/boottmp
备份文件
待备份分区/boot
备份层级0
还原层级0
备份层级1
还原层级1
原来的文件
不包含hello.txt
包含hello.txt
boot.bak0.bz2
备份文件较大
boot.bak1.bz2
备份文件很小
原来的文件
新建文件hello.txt
注:还原时一定要从0开始按照备份层级顺序还原!
图24-1 备份与恢复示意图

上图展示了在Linux备份与恢复中一个非常重要的概念——“备份层级”。以备份/boot分区为例,在当第一次备份时,显然需要将/boot分区完整的备份一遍(备份层级0);但日常一般不会对整个/boot分区进行大的删改,但可能会设计到某些文件的删改,此时为了不重新完整的备份一遍浪费资源,便可以只对上次备份过后新增的删改进行备份(备份层级1)。也就是说,除了备份层级0是完整备份,剩下的备份层级都是在上一级备份的基础上,进行“增量备份”。注意两个要点:

  1. 备份层级只有0~9。到达备份层级9之后会回退到备份层级0重新开始。
  2. “备份层级”的概念只存在于“分区”的备份,对于普通文件/目录只有“备份层级0”

  Linux下使用dump进行备份,使用restore指令进行还原。下面展示如何安装dumprestore

################## 指令速览 #####################
yum -y install dump     # 安装dump
yum -y install restore  # 安装restore################## 实际演示 #####################
# 1. 安装dump
[root@CentOS76 ~]# yum -y install dump
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.ustc.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
base                                                                            | 3.6 kB  00:00:00     
extras                                                                          | 2.9 kB  00:00:00     
updates                                                                         | 2.9 kB  00:00:00     
正在解决依赖关系
--> 正在检查事务
---> 软件包 dump.x86_64.1.0.4-0.23.b44.el7 将被 安装
--> 正在处理依赖关系 rmt,它被软件包 1:dump-0.4-0.23.b44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 rmt.x86_64.2.1.5.2-13.el7 将被 安装
--> 解决依赖关系完成依赖关系解决=======================================================================================================Package             架构                  版本                              源                   大小
=======================================================================================================
正在安装:dump                x86_64                1:0.4-0.23.b44.el7                base                148 k
为依赖而安装:rmt                 x86_64                2:1.5.2-13.el7                    base                103 k事务概要
=======================================================================================================
安装  1 软件包 (+1 依赖软件包)总下载量:251 k
安装大小:581 k
Downloading packages:
(1/2): dump-0.4-0.23.b44.el7.x86_64.rpm                                         | 148 kB  00:00:00     
(2/2): rmt-1.5.2-13.el7.x86_64.rpm                                              | 103 kB  00:00:00     
-------------------------------------------------------------------------------------------------------
总计                                                                   611 kB/s | 251 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装    : 2:rmt-1.5.2-13.el7.x86_64                                                          1/2 正在安装    : 1:dump-0.4-0.23.b44.el7.x86_64                                                     2/2 验证中      : 2:rmt-1.5.2-13.el7.x86_64                                                          1/2 验证中      : 1:dump-0.4-0.23.b44.el7.x86_64                                                     2/2 已安装:dump.x86_64 1:0.4-0.23.b44.el7                                                                       作为依赖被安装:rmt.x86_64 2:1.5.2-13.el7                                                                            完毕!# 2. 安装restore
[root@CentOS76 ~]# yum -y install restore
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.ustc.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
没有可用软件包 restore。
错误:无须任何处理
# 注意上述报错,可能是因为安装dump时顺便安装上了restore# 3. 检验dump和restore是否安装上
[root@CentOS76 ~]# dump
dump 0.4b44 (using libext2fs 1.42.9 of 28-Dec-2013)
usage:	dump [-level#] [-acmMnqSuv] [-A file] [-B records] [-b blocksize][-d density] [-D file] [-e inode#,inode#,...] [-E file][-f file] [-h level] [-I nr errors] [-j zlevel] [-Q file][-s feet] [-T date] [-y] [-z zlevel] filesystemdump [-W | -w]
[root@CentOS76 ~]# restore
restore 0.4b44 (using libext2fs 1.42.9 of 28-Dec-2013)
usage:	restore -C [-cdeHlMvVy] [-b blocksize] [-D filesystem] [-E mls] [-f file] [-F script] [-L limit] [-s fileno]restore -i [-acdehHlmMouvVy] [-A file] [-b blocksize] [-E mls] [-f file] [-F script] [-Q file] [-s fileno]restore -P file [-acdhHlmMuvVy] [-b blocksize][-f file] [-F script] [-s fileno] [-X filelist] [file ...]restore -r [-cdeHlMuvVy] [-b blocksize] [-E mls] [-f file] [-F script] [-s fileno] [-T directory]restore -R [-cdeHlMuvVy] [-b blocksize] [-E mls] [-f file] [-F script] [-s fileno] [-T directory]restore -t [-cdhHlMuvVy] [-A file] [-b blocksize][-f file] [-F script] [-Q file] [-s fileno] [-X filelist] [file ...]restore -x [-acdehHlmMouvVy] [-A file] [-b blocksize] [-E mls] [-f file] [-F script] [-Q file] [-s fileno] [-X filelist] [file ...]

24.2 使用dump备份

  dump为备份工具程序,可将目录或整个文件系统备份至指定的设备,同时支持对整个分区进行增量备份。所谓“增量备份”是指只备份上次备份后 新修改/增加 过的文件,而无需再重新进行完整的备份,也称差异备份。注意上述仅对分区进行备份时支持“增量备份”,普通文件或目录只能使用0级别备份。下面是dump的基本语法:

# 基本语法-dump
dump [选项参数] [目录或文件系统]
dump [-wW]# 常用选项-dump
-0123456789     备份的层级。0为最完整备份,会备份所有文件。若指定0以上的层级,则备份至上一次备份以来修改或新增的文件,到9后可以再次从0开始。
-u              备份完毕后,在/etc/dumpdares中记录备份的文件系统、层级、日期、时间等。
-j              调用bzlib库压缩备份文件,也就是将备份后的文件压缩成bz2格式,让文件更小。
-f<备份后文件名> 指定备份后文件名。
-T<日期>        指定开始备份的时间与日期。
-c              修改备份磁带预设的密度与容量。
-t              指定文件名,若该文件已存在备份文件中,则列出名称。
-W              显示需要备份的文件及其最后一次备份的层级、时间、日期。
-w              与-W类似,但仅显示需要备份的文件。# 常用指令-dump
dump -W             # 显示需要备份的文件及其最后一次备份的层级、时间、日期
cat /etc/dumpdates  # 查看备份时间、文件、次数

下面展示四个dump应用案例:
【案例1】将/boot分区所有内容备份到/opt/boot.bak0.bz2文件中,备份层级为“0”。

################## 指令速览 #####################
dump -0uj -f /opt/boot.bak0.bz2 /boot################## 实际演示 #####################
[root@CentOS76 ~]# cd /opt
[root@CentOS76 opt]# dump -0uj -f /opt/boot.bak0.bz2 /bootDUMP: Date of this level 0 dump: Fri Aug 25 16:20:28 2023DUMP: Dumping /dev/sda1 (/boot) to /opt/boot.bak0.bz2DUMP: Label: noneDUMP: Writing 10 Kilobyte recordsDUMP: Compressing output at compression level 2 (bzlib)DUMP: mapping (Pass I) [regular files]DUMP: mapping (Pass II) [directories]DUMP: estimated 179588 blocks.DUMP: Volume 1 started with block 1 at: Fri Aug 25 16:20:28 2023DUMP: dumping (Pass III) [directories]DUMP: dumping (Pass IV) [regular files]DUMP: Closing /opt/boot.bak0.bz2DUMP: Volume 1 completed at: Fri Aug 25 16:20:41 2023DUMP: Volume 1 took 0:00:13DUMP: Volume 1 transfer rate: 12457 kB/sDUMP: Volume 1 180210kB uncompressed, 161941kB compressed, 1.113:1DUMP: 180210 blocks (175.99MB) on 1 volume(s)DUMP: finished in 13 seconds, throughput 13862 kBytes/secDUMP: Date of this level 0 dump: Fri Aug 25 16:20:28 2023DUMP: Date this dump completed:  Fri Aug 25 16:20:41 2023DUMP: Average transfer rate: 12457 kB/sDUMP: Wrote 180210kB uncompressed, 161941kB compressed, 1.113:1DUMP: DUMP IS DONE
[root@CentOS76 opt]# ll -h
总用量 305M
-rw-r--r--. 1 root root 159M 825 16:20 boot.bak0.bz2
# 其他的文件就不显示了,注意备份文件大小为159M

【案例2】在/boot目录下新建一个hello.txt,然后将/boot分区增量备份到/opt/boot.bak1.bz2文件中(备份层级1)。

此例可发现:

  • 备份层级0文件boot.bak0.bz2大小:159M。
  • 备份层级1文件boot.bak1.bz2大小:12K。
################## 指令速览 #####################
dump -1uj -f /opt/boot.bak1.bz2 /boot################## 实际演示 #####################
[root@CentOS76 opt]# cd /boot
[root@CentOS76 boot]# touch hello.txt
[root@CentOS76 boot]# ll -h
总用量 159M
-rw-r--r--. 1 root root    0 825 16:23 hello.txt
# /boot目录下其他的就不显示了
[root@CentOS76 boot]# dump -1uj -f /opt/boot.bak1.bz2 /bootDUMP: Date of this level 1 dump: Fri Aug 25 16:24:20 2023DUMP: Date of last level 0 dump: Fri Aug 25 16:20:28 2023DUMP: Dumping /dev/sda1 (/boot) to /opt/boot.bak1.bz2DUMP: Label: noneDUMP: Writing 10 Kilobyte recordsDUMP: Compressing output at compression level 2 (bzlib)DUMP: mapping (Pass I) [regular files]DUMP: mapping (Pass II) [directories]DUMP: estimated 35 blocks.DUMP: Volume 1 started with block 1 at: Fri Aug 25 16:24:20 2023DUMP: dumping (Pass III) [directories]DUMP: dumping (Pass IV) [regular files]DUMP: Closing /opt/boot.bak1.bz2DUMP: Volume 1 completed at: Fri Aug 25 16:24:20 2023DUMP: 30 blocks (0.03MB) on 1 volume(s)DUMP: finished in less than a secondDUMP: Date of this level 1 dump: Fri Aug 25 16:24:20 2023DUMP: Date this dump completed:  Fri Aug 25 16:24:20 2023DUMP: Average transfer rate: 0 kB/sDUMP: Wrote 30kB uncompressed, 11kB compressed, 2.728:1DUMP: DUMP IS DONE
[root@CentOS76 boot]# ll -h /opt
总用量 305M
-rw-r--r--. 1 root root 159M 825 16:20 boot.bak0.bz2
-rw-r--r--. 1 root root  12K 825 16:24 boot.bak1.bz2
# /opt目录下其他的文档就不显示了

【案例3】查看使用dump备份的文件及其最后一次备份的层级、时间、日期。

################## 指令速览 #####################
dump -W
cat /etc/dumpdates################## 实际演示 #####################
[root@CentOS76 boot]# dump -W
Last dump(s) done (Dump '>' file systems):
> /dev/sda3	(     /) Last dump: never/dev/sda1	( /boot) Last dump: Level 1, Date Fri Aug 25 16:24:20 2023[root@CentOS76 boot]# cat /etc/dumpdates
/dev/sda1 0 Fri Aug 25 16:20:28 2023 +0800
/dev/sda1 1 Fri Aug 25 16:24:20 2023 +0800

【案例4】使用dump备份/etc整个目录。

  • 注意“实际演示”还演示了普通文件不支持备份层级1、不支持选项-u
################## 指令速览 #####################
dump -0j -f /opt/etc.bak.bz2 /etc/
# 下面一行指令报错!提示子目录只能使用备份层级0!
# dump -1j -f /opt/etc.bak.bz2 /etc/################## 实际演示 #####################
# 1. 演示dump使用“备份层级0”备份普通目录/etc
[root@CentOS76 boot]# dump -0j -f /opt/etc.bak0.bz2 /etc/DUMP: Date of this level 0 dump: Fri Aug 25 16:33:29 2023DUMP: Dumping /dev/sda3 (/ (dir etc)) to /opt/etc.bak0.bz2DUMP: Label: noneDUMP: Writing 10 Kilobyte recordsDUMP: Compressing output at compression level 2 (bzlib)DUMP: mapping (Pass I) [regular files]DUMP: mapping (Pass II) [directories]DUMP: estimated 68703 blocks.DUMP: Volume 1 started with block 1 at: Fri Aug 25 16:33:30 2023DUMP: dumping (Pass III) [directories]DUMP: dumping (Pass IV) [regular files]DUMP: Closing /opt/etc.bak0.bz2DUMP: Volume 1 completed at: Fri Aug 25 16:33:33 2023DUMP: Volume 1 took 0:00:03DUMP: Volume 1 transfer rate: 8208 kB/sDUMP: Volume 1 78350kB uncompressed, 24626kB compressed, 3.182:1DUMP: 78350 blocks (76.51MB) on 1 volume(s)DUMP: finished in 3 seconds, throughput 26116 kBytes/secDUMP: Date of this level 0 dump: Fri Aug 25 16:33:29 2023DUMP: Date this dump completed:  Fri Aug 25 16:33:33 2023DUMP: Average transfer rate: 8208 kB/sDUMP: Wrote 78350kB uncompressed, 24626kB compressed, 3.182:1DUMP: DUMP IS DONE
[root@CentOS76 boot]# ll -h /opt
总用量 353M
-rw-r--r--. 1 root root 159M 825 16:20 boot.bak0.bz2
-rw-r--r--. 1 root root  12K 825 16:24 boot.bak1.bz2
-rw-r--r--. 1 root root  25M 825 16:33 etc.bak0.bz2
# /opt目录下其他的文档就不显示了# 2. 演示dump不支持使用“备份层级1”备份普通目录/etc
[root@CentOS76 boot]# dump -1j -f /opt/etc.bak1.bz2 /etc/DUMP: Only level 0 dumps are allowed on a subdirectoryDUMP: The ENTIRE dump is aborted.# 3. 演示dump不支持使用“选项-u”备份普通目录/etc
[root@CentOS76 boot]# dump -0uj -f /opt/etc.bak0.bz2 /etc/DUMP: You can't update the dumpdates file when dumping a subdirectoryDUMP: The ENTIRE dump is aborted.

24.4 使用restore恢复

  上一节讲了如何使用dump指令进行备份,本节就来介绍如何使用restore指令将备份的文件恢复到指令目录中。只需要注意,若有多个备份层级,从备份层级0开始依次恢复即可。下面是restore指令的基本语法:

# 基本语法-restore
restore [模式选项] [选项]# 模式选项-restore
# 说明:下面四个模式不能混用!一次命令中只能指定一种。
-C   对比模式。将备份的文件与已存在的文件相互对比。
-i   交互模式。在进行还原操作时,restore指令将依序询问用户。
-r   还原模式【使用最多】。有多个备份层级时,从0开始依次还原即可。
-t   查看模式。看备份文件有哪些文件。
# 常用选项-restore
-f<备份设备>    从指定的文件中读取备份数据,进行还原操作# 常用指令-restore
restore -r -f<备份好的文件>

下面展示四个restore指令的应用案例:
【案例1】将/boot/hello.txt文件重命名为hello1.txt,然后使用restore指令的“对比模式”,比较备份文件/opt/boot.bak1.bz2和原目录/boot的区别。

################## 指令速览 #####################
mv /boot/hello.txt /boot/hello1.txt # 重命名/boot/hello.txt
restore -C -f boot.bak1.bz2         # 注意和最新的文件比较################## 实际演示 #####################
# 1. 将文件重命名
[root@CentOS76 boot]# ll -h
总用量 159M
-rw-r--r--. 1 root root    0 825 16:23 hello.txt
# /opt目录下其他的文档就不显示了
[root@CentOS76 boot]# mv /boot/hello.txt /boot/hello1.txt
[root@CentOS76 boot]# ll -h
总用量 159M
-rw-r--r--. 1 root root    0 825 16:23 hello1.txt
# /opt目录下其他的文档就不显示了# 2. 使用“对比模式”查看当前目录与备份文件的区别
[root@CentOS76 boot]# restore -C -f /opt/boot.bak1.bz2
Dump tape is compressed.
Dump   date: Fri Aug 25 16:24:20 2023
Dumped from: Fri Aug 25 16:20:28 2023
Level 1 dump of /boot on CentOS76:/dev/sda1
Label: none
filesys = /boot
restore: unable to stat ./hello.txt: No such file or directory
Some files were modified!  1 compare errors
# 注意上述有1个compare errors。# 3. 再将/boot/hello1.txt文件名改回去,重新使用“对比模式”查看
[root@CentOS76 boot]# mv /boot/hello1.txt /boot/hello.txt
[root@CentOS76 boot]# restore -C -f /opt/boot.bak1.bz2
Dump tape is compressed.
Dump   date: Fri Aug 25 16:24:20 2023
Dumped from: Fri Aug 25 16:20:28 2023
Level 1 dump of /boot on CentOS76:/dev/sda1
Label: none
filesys = /boot

【案例2】使用restore指令的“查看模式”,看备份文件/opt/boot.bak0.bz2有哪些数据/文件。

################## 指令速览 #####################
restore -t -f /opt/boot.bak0.bz2################## 实际演示 #####################
# 1. 看看备份层级1中的文件都记录了啥
[root@CentOS76 boot]# restore -t -f /opt/boot.bak1.bz2
Dump tape is compressed.
Dump   date: Fri Aug 25 16:24:20 2023
Dumped from: Fri Aug 25 16:20:28 2023
Level 1 dump of /boot on CentOS76:/dev/sda1
Label: none2	.346	./hello.txt# 2. 看看备份层级0的文件中都记录了啥
[root@CentOS76 boot]# restore -t -f /opt/boot.bak0.bz2
Dump tape is compressed.
Dump   date: Fri Aug 25 16:20:28 2023
Dumped from: the epoch
Level 0 dump of /boot on CentOS76:/dev/sda1
Label: none2	.11	./lost+found12	./efi13	./efi/EFI14	./efi/EFI/centos22	./efi/EFI/centos/MokManager.efi20	./efi/EFI/centos/BOOT.CSV21	./efi/EFI/centos/BOOTX64.CSV25	./efi/EFI/centos/shimx64-centos.efi23	./efi/EFI/centos/mmx64.efi24	./efi/EFI/centos/shim.efi27	./efi/EFI/centos/fw26	./efi/EFI/centos/shimx64.efi28	./efi/EFI/centos/fwupia32.efi29	./efi/EFI/centos/fwupx64.efi16	./efi/EFI/BOOT18	./efi/EFI/BOOT/fallback.efi17	./efi/EFI/BOOT/BOOTX64.EFI19	./efi/EFI/BOOT/fbx64.efi8193	./grub238	./grub2/device.map39	./grub2/i386-pc41	./grub2/i386-pc/usbtest.mod43	./grub2/i386-pc/nativedisk.mod45	./grub2/i386-pc/ldm.mod46	./grub2/i386-pc/crypto.mod48	./grub2/i386-pc/part_acorn.mod49	./grub2/i386-pc/spkmodem.mod52	./grub2/i386-pc/gcry_dsa.mod54	./grub2/i386-pc/hashsum.mod56	./grub2/i386-pc/gcry_md5.mod57	./grub2/i386-pc/testspeed.mod58	./grub2/i386-pc/gcry_serpent.mod59	./grub2/i386-pc/keylayouts.mod60	./grub2/i386-pc/bitmap_scale.mod64	./grub2/i386-pc/file.mod67	./grub2/i386-pc/sfs.mod68	./grub2/i386-pc/at_keyboard.mod69	./grub2/i386-pc/aout.mod70	./grub2/i386-pc/mda_text.mod71	./grub2/i386-pc/minix2_be.mod72	./grub2/i386-pc/gfxterm.mod75	./grub2/i386-pc/halt.mod78	./grub2/i386-pc/mmap.mod79	./grub2/i386-pc/squash4.mod81	./grub2/i386-pc/minix2.mod83	./grub2/i386-pc/syslinuxcfg.mod84	./grub2/i386-pc/regexp.mod85	./grub2/i386-pc/ls.mod86	./grub2/i386-pc/bufio.mod88	./grub2/i386-pc/romfs.mod89	./grub2/i386-pc/exfctest.mod91	./grub2/i386-pc/ufs1_be.mod92	./grub2/i386-pc/odc.mod93	./grub2/i386-pc/gdb.mod95	./grub2/i386-pc/priority_queue.mod98	./grub2/i386-pc/part_dvh.mod101	./grub2/i386-pc/sendkey.mod102	./grub2/i386-pc/cmdline_cat_test.mod106	./grub2/i386-pc/sleep_test.mod110	./grub2/i386-pc/test.mod113	./grub2/i386-pc/dm_nv.mod114	./grub2/i386-pc/usbserial_common.mod115	./grub2/i386-pc/jpeg.mod120	./grub2/i386-pc/vga_text.mod124	./grub2/i386-pc/test_blockarg.mod128	./grub2/i386-pc/echo.mod130	./grub2/i386-pc/part_apple.mod131	./grub2/i386-pc/gcry_des.mod133	./grub2/i386-pc/gcry_md4.mod134	./grub2/i386-pc/boot.mod137	./grub2/i386-pc/parttool.mod138	./grub2/i386-pc/zfs.mod140	./grub2/i386-pc/part_sunpc.mod141	./grub2/i386-pc/geli.mod142	./grub2/i386-pc/http.mod143	./grub2/i386-pc/efiemu.mod145	./grub2/i386-pc/terminal.mod147	./grub2/i386-pc/pxechain.mod148	./grub2/i386-pc/datetime.mod154	./grub2/i386-pc/ext2.mod155	./grub2/i386-pc/affs.mod159	./grub2/i386-pc/linux16.mod160	./grub2/i386-pc/hexdump.mod163	./grub2/i386-pc/lzopio.mod164	./grub2/i386-pc/biosdisk.mod165	./grub2/i386-pc/gzio.mod167	./grub2/i386-pc/cpio_be.mod168	./grub2/i386-pc/testload.mod169	./grub2/i386-pc/multiboot2.mod175	./grub2/i386-pc/verify.mod178	./grub2/i386-pc/ntfs.mod181	./grub2/i386-pc/help.mod183	./grub2/i386-pc/gcry_rmd160.mod184	./grub2/i386-pc/backtrace.mod186	./grub2/i386-pc/password_pbkdf2.mod188	./grub2/i386-pc/gcry_rijndael.mod189	./grub2/i386-pc/udf.mod190	./grub2/i386-pc/usbserial_pl2303.mod191	./grub2/i386-pc/legacy_password_test.mod192	./grub2/i386-pc/lsacpi.mod199	./grub2/i386-pc/mdraid09_be.mod201	./grub2/i386-pc/fshelp.mod202	./grub2/i386-pc/search_fs_file.mod203	./grub2/i386-pc/minix3.mod204	./grub2/i386-pc/gcry_sha1.mod205	./grub2/i386-pc/png.mod206	./grub2/i386-pc/fat.mod209	./grub2/i386-pc/relocator.mod212	./grub2/i386-pc/ufs2.mod213	./grub2/i386-pc/bitmap.mod214	./grub2/i386-pc/minix.mod216	./grub2/i386-pc/memrw.mod220	./grub2/i386-pc/reboot.mod223	./grub2/i386-pc/macbless.mod224	./grub2/i386-pc/macho.mod226	./grub2/i386-pc/cmosdump.mod227	./grub2/i386-pc/cbls.mod230	./grub2/i386-pc/gcry_crc.mod231	./grub2/i386-pc/gcry_camellia.mod234	./grub2/i386-pc/usbms.mod237	./grub2/i386-pc/gcry_cast5.mod240	./grub2/i386-pc/minicmd.mod241	./grub2/i386-pc/gcry_tiger.mod242	./grub2/i386-pc/cbmemc.mod243	./grub2/i386-pc/uhci.mod245	./grub2/i386-pc/gcry_rfc2268.mod246	./grub2/i386-pc/pcidump.mod248	./grub2/i386-pc/gcry_sha512.mod252	./grub2/i386-pc/pci.mod255	./grub2/i386-pc/xfs.mod262	./grub2/i386-pc/ntfscomp.mod263	./grub2/i386-pc/raid5rec.mod268	./grub2/i386-pc/xnu_uuid.mod269	./grub2/i386-pc/exfat.mod271	./grub2/i386-pc/usbserial_usbdebug.mod272	./grub2/i386-pc/setpci.mod273	./grub2/i386-pc/reiserfs.mod276	./grub2/i386-pc/hfs.mod278	./grub2/i386-pc/minix3_be.mod279	./grub2/i386-pc/ufs1.mod281	./grub2/i386-pc/bfs.mod283	./grub2/i386-pc/eval.mod284	./grub2/i386-pc/tga.mod285	./grub2/i386-pc/mdraid1x.mod286	./grub2/i386-pc/gcry_rsa.mod288	./grub2/i386-pc/ata.mod289	./grub2/i386-pc/archelp.mod292	./grub2/i386-pc/gcry_sha256.mod295	./grub2/i386-pc/blocklist.mod296	./grub2/i386-pc/cpuid.mod297	./grub2/i386-pc/part_plan.mod298	./grub2/i386-pc/moddep.lst299	./grub2/i386-pc/command.lst305	./grub2/i386-pc/terminal.lst345	./grub2/i386-pc/boot.img177	./grub2/i386-pc/font.mod236	./grub2/i386-pc/video_bochs.mod123	./grub2/i386-pc/cryptodisk.mod144	./grub2/i386-pc/drivemap.mod87	./grub2/i386-pc/gcry_whirlpool.mod119	./grub2/i386-pc/part_amiga.mod235	./grub2/i386-pc/ntldr.mod74	./grub2/i386-pc/part_bsd.mod44	./grub2/i386-pc/diskfilter.mod139	./grub2/i386-pc/video_colors.mod76	./grub2/i386-pc/morse.mod97	./grub2/i386-pc/vga.mod62	./grub2/i386-pc/functional_test.mod170	./grub2/i386-pc/elf.mod158	./grub2/i386-pc/ohci.mod80	./grub2/i386-pc/setjmp.mod116	./grub2/i386-pc/configfile.mod135	./grub2/i386-pc/msdospart.mod211	./grub2/i386-pc/all_video.mod210	./grub2/i386-pc/afs.mod182	./grub2/i386-pc/signature_test.mod77	./grub2/i386-pc/cs5536.mod180	./grub2/i386-pc/minix_be.mod229	./grub2/i386-pc/progress.mod174	./grub2/i386-pc/sleep.mod225	./grub2/i386-pc/memdisk.mod215	./grub2/i386-pc/bsd.mod176	./grub2/i386-pc/play.mod108	./grub2/i386-pc/gcry_blowfish.mod198	./grub2/i386-pc/gfxterm_background.mod94	./grub2/i386-pc/lspci.mod132	./grub2/i386-pc/disk.mod111	./grub2/i386-pc/plan9.mod104	./grub2/i386-pc/xnu.mod129	./grub2/i386-pc/btrfs.mod66	./grub2/i386-pc/videoinfo.mod53	./grub2/i386-pc/gcry_twofish.mod200	./grub2/i386-pc/probe.mod166	./grub2/i386-pc/usb.mod103	./grub2/i386-pc/chain.mod125	./grub2/i386-pc/hfspluscomp.mod118	./grub2/i386-pc/extcmd.mod63	./grub2/i386-pc/iso9660.mod193	./grub2/i386-pc/mpi.mod51	./grub2/i386-pc/lsmmap.mod50	./grub2/i386-pc/videotest.mod47	./grub2/i386-pc/keystatus.mod196	./grub2/i386-pc/iorw.mod73	./grub2/i386-pc/lvm.mod105	./grub2/i386-pc/truecrypt.mod121	./grub2/i386-pc/gcry_idea.mod218	./grub2/i386-pc/trig.mod122	./grub2/i386-pc/tftp.mod208	./grub2/i386-pc/procfs.mod99	./grub2/i386-pc/part_gpt.mod232	./grub2/i386-pc/loadenv.mod156	./grub2/i386-pc/videotest_checksum.mod61	./grub2/i386-pc/hdparm.mod197	./grub2/i386-pc/net.mod221	./grub2/i386-pc/search_label.mod151	./grub2/i386-pc/raid6rec.mod161	./grub2/i386-pc/jfs.mod100	./grub2/i386-pc/tr.mod194	./grub2/i386-pc/cbtable.mod42	./grub2/i386-pc/video.mod195	./grub2/i386-pc/usbserial_ftdi.mod187	./grub2/i386-pc/cmostest.mod146	./grub2/i386-pc/datehook.mod152	./grub2/i386-pc/scsi.mod65	./grub2/i386-pc/usb_keyboard.mod153	./grub2/i386-pc/xnu_uuid_test.mod173	./grub2/i386-pc/video_fb.mod233	./grub2/i386-pc/pata.mod228	./grub2/i386-pc/date.mod127	./grub2/i386-pc/password.mod162	./grub2/i386-pc/setjmp_test.mod55	./grub2/i386-pc/hfsplus.mod172	./grub2/i386-pc/gcry_seed.mod82	./grub2/i386-pc/multiboot.mod219	./grub2/i386-pc/time.mod136	./grub2/i386-pc/serial.mod109	./grub2/i386-pc/freedos.mod185	./grub2/i386-pc/cpio.mod238	./grub2/i386-pc/tar.mod217	./grub2/i386-pc/div_test.mod179	./grub2/i386-pc/part_msdos.mod171	./grub2/i386-pc/ahci.mod157	./grub2/i386-pc/search_fs_uuid.mod126	./grub2/i386-pc/search.mod107	./grub2/i386-pc/cmp.mod150	./grub2/i386-pc/cbfs.mod207	./grub2/i386-pc/mdraid09.mod90	./grub2/i386-pc/gptsync.mod149	./grub2/i386-pc/blscfg.mod222	./grub2/i386-pc/lsapm.mod112	./grub2/i386-pc/acpi.mod117	./grub2/i386-pc/linux.mod96	./grub2/i386-pc/ehci.mod239	./grub2/i386-pc/pbkdf2.mod244	./grub2/i386-pc/xzio.mod247	./grub2/i386-pc/pxe.mod249	./grub2/i386-pc/nilfs2.mod250	./grub2/i386-pc/read.mod251	./grub2/i386-pc/loopback.mod253	./grub2/i386-pc/adler32.mod254	./grub2/i386-pc/zfscrypt.mod256	./grub2/i386-pc/gcry_arcfour.mod257	./grub2/i386-pc/part_dfly.mod258	./grub2/i386-pc/gfxmenu.mod259	./grub2/i386-pc/true.mod260	./grub2/i386-pc/crc64.mod261	./grub2/i386-pc/cat.mod264	./grub2/i386-pc/pbkdf2_test.mod265	./grub2/i386-pc/hello.mod266	./grub2/i386-pc/vbe.mod267	./grub2/i386-pc/gettext.mod270	./grub2/i386-pc/cbtime.mod274	./grub2/i386-pc/luks.mod275	./grub2/i386-pc/gfxterm_menu.mod277	./grub2/i386-pc/normal.mod280	./grub2/i386-pc/legacycfg.mod282	./grub2/i386-pc/offsetio.mod287	./grub2/i386-pc/newc.mod290	./grub2/i386-pc/part_sun.mod291	./grub2/i386-pc/zfsinfo.mod293	./grub2/i386-pc/terminfo.mod294	./grub2/i386-pc/video_cirrus.mod300	./grub2/i386-pc/fs.lst301	./grub2/i386-pc/partmap.lst302	./grub2/i386-pc/parttool.lst303	./grub2/i386-pc/video.lst304	./grub2/i386-pc/crypto.lst306	./grub2/i386-pc/modinfo.sh344	./grub2/i386-pc/core.img40	./grub2/locale307	./grub2/locale/en@cyrillic.mo308	./grub2/locale/da.mo309	./grub2/locale/fr.mo310	./grub2/locale/gl.mo311	./grub2/locale/id.mo312	./grub2/locale/en@arabic.mo313	./grub2/locale/de_CH.mo314	./grub2/locale/zh_TW.mo315	./grub2/locale/it.mo316	./grub2/locale/de@hebrew.mo317	./grub2/locale/ca.mo318	./grub2/locale/de.mo319	./grub2/locale/en@greek.mo320	./grub2/locale/zh_CN.mo321	./grub2/locale/ast.mo322	./grub2/locale/es.mo323	./grub2/locale/tr.mo324	./grub2/locale/sl.mo325	./grub2/locale/pa.mo326	./grub2/locale/fi.mo327	./grub2/locale/pt_BR.mo328	./grub2/locale/eo.mo329	./grub2/locale/hu.mo330	./grub2/locale/ru.mo331	./grub2/locale/vi.mo332	./grub2/locale/nl.mo333	./grub2/locale/en@quot.mo334	./grub2/locale/uk.mo335	./grub2/locale/en@piglatin.mo336	./grub2/locale/ja.mo337	./grub2/locale/en@hebrew.mo338	./grub2/locale/lt.mo339	./grub2/locale/pl.mo340	./grub2/locale/sv.mo341	./grub2/fonts342	./grub2/fonts/unicode.pf2343	./grub2/grubenv353	./grub2/grub.cfg8194	./grub15	./grub/splash.xpm.gz35	./initramfs-3.10.0-1160.el7.x86_64.img30	./.vmlinuz-3.10.0-1160.el7.x86_64.hmac31	./System.map-3.10.0-1160.el7.x86_6432	./config-3.10.0-1160.el7.x86_6433	./symvers-3.10.0-1160.el7.x86_64.gz34	./vmlinuz-3.10.0-1160.el7.x86_6436	./initramfs-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d.img37	./vmlinuz-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d352	./initramfs-3.10.0-1160.95.1.el7.x86_64.img347	./.vmlinuz-3.10.0-1160.95.1.el7.x86_64.hmac348	./System.map-3.10.0-1160.95.1.el7.x86_64349	./config-3.10.0-1160.95.1.el7.x86_64350	./symvers-3.10.0-1160.95.1.el7.x86_64.gz351	./vmlinuz-3.10.0-1160.95.1.el7.x86_64

【案例3】使用restore指令的“还原模式”,将/boot目录的备份还原到/opt/boottmp目录中。

################## 指令速览 #####################
mkdir /opt/boottmp
cd /opt/boottmp
restore -r -f /opt/boot.bak0.bz2  # 恢复备份层级0
restore -r -f /opt/boot.bak1.bz2  # 恢复备份层级1################## 实际演示 #####################
# 1. 恢复备份层级0
[root@CentOS76 boot]# mkdir /opt/boottmp
[root@CentOS76 boot]# cd /opt/boottmp/
[root@CentOS76 boottmp]# restore -r -f /opt/boot.bak0.bz2
Dump tape is compressed.
[root@CentOS76 boottmp]# ll -h
总用量 160M
-rw-r--r--. 1 root root 151K 724 22:03 config-3.10.0-1160.95.1.el7.x86_64
-rw-r--r--. 1 root root 150K 1020 2020 config-3.10.0-1160.el7.x86_64
drwx------. 3 root root 4.0K 729 2020 efi
drwxr-xr-x. 2 root root 4.0K 713 17:07 grub
drwx------. 5 root root 4.0K 825 11:17 grub2
-rw-------. 1 root root  77M 713 17:10 initramfs-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d.img
-rw-------. 1 root root  28M 825 11:17 initramfs-3.10.0-1160.95.1.el7.x86_64.img
-rw-------. 1 root root  28M 713 17:12 initramfs-3.10.0-1160.el7.x86_64.img
drwx------. 2 root root 4.0K 713 17:06 lost+found
-rw-------. 1 root root 143K 825 17:01 restoresymtable
-rw-r--r--. 1 root root 314K 724 22:04 symvers-3.10.0-1160.95.1.el7.x86_64.gz
-rw-r--r--. 1 root root 314K 1020 2020 symvers-3.10.0-1160.el7.x86_64.gz
-rw-------. 1 root root 3.5M 724 22:03 System.map-3.10.0-1160.95.1.el7.x86_64
-rw-------. 1 root root 3.5M 1020 2020 System.map-3.10.0-1160.el7.x86_64
-rwxr-xr-x. 1 root root 6.5M 713 17:10 vmlinuz-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d
-rwxr-xr-x. 1 root root 6.8M 724 22:03 vmlinuz-3.10.0-1160.95.1.el7.x86_64
-rwxr-xr-x. 1 root root 6.5M 1020 2020 vmlinuz-3.10.0-1160.el7.x86_64
# 可以发现上述没有hello.txt# 2. 恢复备份层级1
[root@CentOS76 boottmp]# restore -r -f /opt/boot.bak1.bz2
Dump tape is compressed.
[root@CentOS76 boottmp]# ll -h
总用量 160M
-rw-r--r--. 1 root root 151K 724 22:03 config-3.10.0-1160.95.1.el7.x86_64
-rw-r--r--. 1 root root 150K 1020 2020 config-3.10.0-1160.el7.x86_64
drwx------. 3 root root 4.0K 729 2020 efi
drwxr-xr-x. 2 root root 4.0K 713 17:07 grub
drwx------. 5 root root 4.0K 825 11:17 grub2
-rw-r--r--. 1 root root    0 825 16:23 hello.txt
-rw-------. 1 root root  77M 713 17:10 initramfs-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d.img
-rw-------. 1 root root  28M 825 11:17 initramfs-3.10.0-1160.95.1.el7.x86_64.img
-rw-------. 1 root root  28M 713 17:12 initramfs-3.10.0-1160.el7.x86_64.img
drwx------. 2 root root 4.0K 713 17:06 lost+found
-rw-------. 1 root root 143K 825 17:02 restoresymtable
-rw-r--r--. 1 root root 314K 724 22:04 symvers-3.10.0-1160.95.1.el7.x86_64.gz
-rw-r--r--. 1 root root 314K 1020 2020 symvers-3.10.0-1160.el7.x86_64.gz
-rw-------. 1 root root 3.5M 724 22:03 System.map-3.10.0-1160.95.1.el7.x86_64
-rw-------. 1 root root 3.5M 1020 2020 System.map-3.10.0-1160.el7.x86_64
-rwxr-xr-x. 1 root root 6.5M 713 17:10 vmlinuz-0-rescue-0d4bcac3ad0e4afe96e50f962baa9f7d
-rwxr-xr-x. 1 root root 6.8M 724 22:03 vmlinuz-3.10.0-1160.95.1.el7.x86_64
-rwxr-xr-x. 1 root root 6.5M 1020 2020 vmlinuz-3.10.0-1160.el7.x86_64
# 可以上述已经恢复出hello.txt

【案例4】使用restore指令恢复备份的文件,恢复/etc/整个目录的备份。

################## 指令速览 #####################
mkdir /opt/etctmp
cd /opt/etctmp/
restore -r -f /opt/etc.bak0.bz2################## 实际演示 #####################
[root@CentOS76 boottmp]# mkdir /opt/etctmp
[root@CentOS76 boottmp]# cd /opt/etctmp/
[root@CentOS76 etctmp]# restore -r -f /opt/etc.bak0.bz2
Dump tape is compressed.
./lost+found: (inode 11) not found on tape
./boot: (inode 655361) not found on tape
./dev: (inode 131073) not found on tape
./proc: (inode 262145) not found on tape
./run: (inode 917505) not found on tape
./sys: (inode 393217) not found on tape
./root: (inode 786433) not found on tape
./var: (inode 131074) not found on tape
./tmp: (inode 262146) not found on tape
./data: (inode 799503) not found on tape
./usr: (inode 393218) not found on tape
./bin: (inode 17) not found on tape
./sbin: (inode 16) not found on tape
./lib: (inode 13) not found on tape
./lib64: (inode 15) not found on tape
./home: (inode 655362) not found on tape
./media: (inode 917506) not found on tape
./mnt: (inode 786434) not found on tape
./opt: (inode 655363) not found on tape
./srv: (inode 917507) not found on tape
[root@CentOS76 etctmp]# ls
etc  restoresymtable
[root@CentOS76 etctmp]# ls /opt/etctmp/etc
abrt                        firefox         magic                     rmt
adjtime                     firewalld       mail.rc                   rpc
aliases                     flatpak         makedumpfile.conf.sample  rpm
aliases.db                  fonts           man_db.conf               rsyncd.conf
alsa                        fprintd.conf    maven                     rsyslog.conf
alternatives                fstab           mke2fs.conf               rsyslog.d
anacrontab                  fuse.conf       modprobe.d                rwtab
asound.conf                 fwupd           modules-load.d            rwtab.d
at.deny                     gconf           motd                      samba
audisp                      gcrypt          mtab                      sane.d
audit                       gdbinit         mtools.conf               sasl2
autofs.conf                 gdbinit.d       multipath                 scl
autofs_ldap_auth.conf       gdm             my.cnf                    securetty
auto.master                 geoclue         my.cnf.d                  security
auto.master.d               GeoIP.conf      nanorc                    selinux
auto.misc                   ghostscript     ndctl                     services
auto.net                    glvnd           netconfig                 sestatus.conf
auto.smb                    gnupg           NetworkManager            setroubleshoot
avahi                       GREP_COLORS     networks                  setuptool.d
bash_completion.d           groff           nfs.conf                  sgml
bashrc                      group           nfsmount.conf             shadow
binfmt.d                    group-          nsswitch.conf             shadow-
bluetooth                   grub2.cfg       nsswitch.conf.bak         shells
brltty                      grub.d          ntp                       skel
brltty.conf                 gshadow         ntp.conf                  smartmontools
centos-release              gshadow-        numad.conf                sos.conf
centos-release-upstream     gss             oddjob                    speech-dispatcher
certmonger                  gssproxy        oddjobd.conf              ssh
cgconfig.conf               host.conf       oddjobd.conf.d            ssl
cgconfig.d                  hostname        openldap                  sssd
cgrules.conf                hosts           opt                       statetab
cgsnapshot_blacklist.conf   hosts.allow     os-release                statetab.d
chkconfig.d                 hosts.deny      PackageKit                subgid
chrony.conf                 hp              pam.d                     subuid
chrony.keys                 idmapd.conf     papersize                 subversion
cifs-utils                  init.d          passwd                    sudo.conf
cron.d                      inittab         passwd-                   sudoers
cron.daily                  inputrc         pbm2ppa.conf              sudoers.d
cron.deny                   ipa             pinforc                   sudo-ldap.conf
cron.hourly                 iproute2        pkcs11                    sysconfig
cron.monthly                ipsec.conf      pki                       sysctl.conf
crontab                     ipsec.d         plymouth                  sysctl.d
cron.weekly                 ipsec.secrets   pm                        systemd
crypttab                    iscsi           pnm2ppa.conf              system-release
csh.cshrc                   issue           polkit-1                  system-release-cpe
csh.login                   issue.net       popt.d                    target
cups                        java            postfix                   tcsd.conf
cupshelpers                 jvm             ppp                       terminfo
dbus-1                      jvm-commmon     prelink.conf.d            tmpfiles.d
dconf                       kdump.conf      printcap                  trusted-key.key
default                     kernel          profile                   tuned
depmod.d                    krb5.conf       profile.d                 udev
dhcp                        krb5.conf.d     protocols                 udisks2
DIR_COLORS                  ksmtuned.conf   pulse                     unbound
DIR_COLORS.256color         ld.so.cache     purple                    updatedb.conf
DIR_COLORS.lightbgcolor     ld.so.conf      python                    UPower
dleyna-server-service.conf  ld.so.conf.d    qemu-ga                   usb_modeswitch.conf
dnsmasq.conf                libaudit.conf   qemu-kvm                  vconsole.conf
dnsmasq.d                   libblockdev     radvd.conf                vimrc
dracut.conf                 libibverbs.d    rc0.d                     virc
dracut.conf.d               libnl           rc1.d                     vmware-tools
dumpdates                   libpaper.d      rc2.d                     wgetrc
e2fsck.conf                 libreport       rc3.d                     wpa_supplicant
egl                         libuser.conf    rc4.d                     wvdial.conf
enscript.cfg                libvirt         rc5.d                     X11
environment                 locale.conf     rc6.d                     xdg
ethertypes                  localtime       rc.d                      xinetd.d
exports                     login.defs      rc.local                  xml
exports.d                   logrotate.conf  rdma                      yum
favicon.png                 logrotate.d     redhat-release            yum.conf
fcoe                        lsm             request-key.conf          yum.repos.d
festival                    lvm             request-key.d
filesystems                 machine-id      resolv.conf

  1. 《鸟哥的Linux私房菜 基础学习篇 第四版》 ↩︎

  2. 《鸟哥的Linux私房菜 服务器架设篇 第三版》 ↩︎

  3. 《韩顺平_2021图解Linux全面升级》 ↩︎

相关文章:

24 Linux高级篇-备份与恢复

24 Linux高级篇-备份与恢复 文章目录 24 Linux高级篇-备份与恢复24.1 安装dump和restore24.2 使用dump备份24.4 使用restore恢复 学习视频来自于B站【小白入门 通俗易懂】2021韩顺平 一周学会Linux。可能会用到的资料有如下所示&#xff0c;下载链接见文末&#xff1a; 《鸟哥的…...

微信小程序的图书馆预约系统设计与实现

摘 要 近年来随着社会竞争压力的不断加剧&#xff0c;人们需要不断充实自己的学识来提升自己的竞争力&#xff0c;对于在校的大学生而言需要利用在校期间实现考研考编的内容&#xff0c;职场的上班族需要通过考取职业技能资格证书来实现升职加薪&#xff0c;各行各业的人们都在…...

《2023年网信人才培训-网络安全从业人员能力素养提升培训》第一期成功举办

随着网络强国和数字中国建设的步伐加快&#xff0c;建设规模宏大、结构合理、素质优良的人才队伍成为一项重要工作。知了汇智作为数字产教融合基地&#xff0c;通过与高校、企业等多方合作&#xff0c;建立了完整的网络安全人才培养生态链。凭借自身技术优势和丰富的产业资源&a…...

WebGpu VS WebGL

推荐&#xff1a;使用 NSDT场景编辑器 助你快速搭建3D应用场景 WEBGPU VS. WEBGL 粗略地概述一下WebGPU与WebGL的不同之处是很有用的。在不涉及太多复杂的技术细节的情况下&#xff0c;两者的整体设计大致如下&#xff1a; WebGL和OpenGL一样&#xff0c;涉及许多单独的函数调…...

HTML <tfoot> 标签

实例 带有 thead、tbody 以及 tfoot 元素的 HTML 表格: <table border="1"><thead><tr><th>Month</th><th>Savings</th></tr></thead><tfoot><tr><td>Sum</td><td>$180<…...

VScode的PHP远程调试模式Xdebug

目录 第一步、安装VScode中相应插件 remote-ssh的原理 ssh插件&#xff1a; PHP相关插件&#xff1a; 第二步、安装对应PHP版本的xdebug 查看PHP具体配置信息的phpinfo页面 1、首先&#xff0c;打开php编辑器&#xff0c;新建一个php文件&#xff0c;例如&#xff1a;inde…...

HTML5-2-链接

HTML使用标签 <a>来设置超文本链接。 超链接可以是一个字&#xff0c;一个词&#xff0c;或者一组词&#xff0c;也可以是一幅图像&#xff0c;您可以点击这些内容来跳转到新的文档或者当前文档中的某个部分。 默认情况下&#xff0c;链接将以以下形式出现在浏览器中&am…...

Java--常用jar命令

jar常用指令 jar命令参数&#xff1a; jar命令格式&#xff1a;jar {c t x u f }[ v m e 0 M i ][-C 目录]文件名... 其中{ctxu}这四个参数必须选选其一。[v f m e 0 M i ]是可选参数&#xff0c;文件名也是必须的。 -c 创建一个jar包 -t 显示jar中的内容列表 -x 解压jar包 …...

微服务中间件--多级缓存

多级缓存 多级缓存a.JVM进程缓存1) Caffeine2) 案例 b.Lua语法1) 变量和循环2) 条件控制、函数 c.多级缓存1) 安装OpenResty2) 请求参数处理3) 查询Tomcat4) Redis缓存预热5) 查询Redis缓存6) Nginx本地缓存 d.缓存同步1) 数据同步策略2) 安装Canal2.a) 开启MySQL主从2.b) 安装…...

clickhouse系列3:clickhouse分析英国房产价格数据

1.准备数据集 该数据集包含有关英格兰和威尔士自1995年起到2023年的房地产价格的数据,超过2800万条记录,未压缩形式的数据集大小超过4GB,在ClickHouse中需要约306MB。 2.clickhouse中建表 CREATE TABLE uk_price_paid (price UInt32,...

2023京东口腔护理赛道行业数据分析(京东销售数据分析)

近年来&#xff0c;口腔护理逐渐成为年轻人重视的健康领域&#xff0c;从口腔护理整体市场来看&#xff0c;牙膏和牙刷等基础口腔护理产品仍占据主导地位。不过&#xff0c;随着口腔护理市场逐步朝向精致化、专业化、多元化等方向发展&#xff0c;不少新兴口腔护理产品受到消费…...

安服面试 --- 01

1、常用渗透工具 burp、nmap、sqlmap、蚁剑、御剑、冰蝎、cobalt strike等 2、渗透测试中&#xff0c;拿到目标公司站点&#xff0c;接下来应该怎么做&#xff1f; &#xff08;1&#xff09;信息收集&#xff1a;收集目标公司的相关信息。包括域名、ip地址、子域名、开放端…...

ExpressLRS开源之RC链路性能测试

ExpressLRS开源之RC链路性能测试 1. 源由2. 分析3. 测试方案4. 测试设计4.1 校准测试4.2 实验室测试4.3 拉距测试4.4 遮挡测试 5. 总结6. 参考资料 1. 源由 基于ExpressLRS开源基本调试验证方法&#xff0c;对RC链路性能进行简单的性能测试。 修改设计总能够满足合理的需求&a…...

el-form表单el-form-item prop一次验证两个值

1.表单添加两个框&#xff0c;prop写上 <el-form :model"ruleForm" :rules"rules" ref"ruleForm" label-width"100px" > <el-form-item type"type" label"时间" prop"dateSectOne"><di…...

HTTP 代理原理及 Python 简单实现

HTTP 代理是一种网络代理服务器(Proxy Server),它能够作为客户端与 HTTP 服务器之间的中介,它的工作原理是: 当客户端向 HTTP 代理发送 HTTP 请求时,HTTP 代理会收到请求。 HTTP 代理会将请求转发给目标 HTTP 服务器。 目标 HTTP 服务器处理请求并生成响应。 HTTP 代理将…...

数据结构--队列与循环队列

队列 队列是什么&#xff0c;先联想一下队&#xff0c;排队先来的人排前面先出&#xff0c;后来的人排后面后出&#xff1b;队列的性质也一样&#xff0c;先进队列的数据先出&#xff0c;后进队列的后出&#xff1b;就像图一的样子&#xff1a; 图1 如图1&#xff0c;1号元素是…...

八路参考文献:[八一新书]许少辉.乡村振兴战略下传统村落文化旅游设计[M]北京:中国建筑工业出版社,2022.

八路参考文献&#xff1a;&#xff3b;八一新书&#xff3d;许少辉&#xff0e;乡村振兴战略下传统村落文化旅游设计&#xff3b;&#xff2d;&#xff3d;北京&#xff1a;中国建筑工业出版社&#xff0c;&#xff12;&#xff10;&#xff12;&#xff12;&#xff0e;...

版本控制 Git工具的使用

版本控制的概念&#xff1a; 版本控制&#xff08;Revision control&#xff09;是一种在开发的过程中用于管理我们对文件、目录或工程等内容的修改历史&#xff0c;方便查看更改历史记录&#xff0c;备份以便恢复以前的版本的软件工程技术。简单来说就是用于管理多人协同开发…...

GNS3 在 Linux 上的安装指南

文章目录 GNS3 在 Linux 上的安装指南1. 基于 Ubuntu 的发行版安装 GNS32. 基于 Debian 的安装3. 基于 ArchLinux 的安装4. 从 Pypi 安装 GNS35. 启动 GNS3 服务端GNS3 在 Linux 上的安装指南 大家好,今天我们来聊聊如何在 Linux 上安装 GNS3。GNS3 是一个非常受欢迎的网络模…...

Mybatis中 list.size() = 1 但显示 All elements are null

一、Bug展示 二、原因分析 2.1.情形一&#xff1a;Mybatis的XML中返回类型映射错误 <select id"selectByDesc" parameterType"com.task.bean.OrderInfo"resultType"com.task.bean.OrderInfo">select MER_ID,SETTLE_DATE,ICE_NAME,ORDER_S…...

Soul的社交元宇宙之路,还有多远?

在元宇宙概念爆火的当下&#xff0c;以互联网为依托的虚拟社交逐步为用户承载起其空缺的精神交流与寄托&#xff0c;而在这其中&#xff0c;以“跟随灵魂找到你”为Slogan&#xff0c;主打年轻人社交元宇宙平台的APP--Soul则在这条赛道上凭借着独特的风格&#xff0c;逐步突出重…...

如何解决Memcached缓存击穿和雪崩问题

原文 Memcached是一种快速、高性能的分布式内存对象缓存系统&#xff0c;广泛应用于Web应用的缓存中。然而&#xff0c;Memcached也存在一些常见的问题&#xff0c;如缓存击穿和缓存雪崩。本文将介绍什么是缓存击穿和缓存雪崩&#xff0c;并提供一些解决这些问题的方法&#x…...

uniapp 开发之仿抖音,上下滑动切换视频、点击小爱心效果

效果图&#xff1a; 功能描述&#xff1a; 上下滑动视频&#xff0c;双击暂停&#xff0c;然后第一个视频再往上滑显示”已经滑到顶了“ 开始代码&#xff1a; 首先视频接口使用的公开的视频测试接口 开放API-2.0 官网展示 Swagger UI 接口文档 一…...

【C++设计模式】依赖倒转原则

2023年8月30日&#xff0c;周三上午 目录 概述含义举个简单的例子传统做法使用依赖倒转原则代码说明再举一个具体的例子以生活为例 概述 依赖倒转原则(Dependency Inversion Principle,DIP)是面向对象设计中的一个基本原则。 含义 高层模块不应该依赖低层模块,两者都应该依…...

浙江首例!金华银行基于完全国产自研数据库构建新一代核心系统

6 月 12 日&#xff0c;金华银行举行“星辉工程”核心项目群上线发布会&#xff0c;新一代核心系统部署在国产分布式数据库 OceanBase 上&#xff0c;实现系统的高可用、高性能、国产升级。据悉&#xff0c;这是浙江省首例基于完全国产自研数据库落地的银行核心系统。 金华银行…...

ASP.NET Core 中的 静态文件

Static Files Static Files 包括 HTML&#xff0c;CSS&#xff0c;图片&#xff0c;JavaScript&#xff0c;以及其他静态资源文件。 即网站本身的内容。 Static Files 服务 Static Files 保存在项目的 Web Root 目录&#xff0c;即 wwwroot 文件夹中。 而wwwroot目录是Conte…...

2023年天府杯——C 题:码头停靠问题

问题背景&#xff1a; 某个港口有多个不同类型的码头&#xff0c;可以停靠不同种类的船只。每 艘船只需要一定的时间来完成装卸货物等任务&#xff0c;并且每个码头有容量 限制和停靠时间限制。港口需要在保证收益的情况下&#xff0c;尽可能地提高 运营效率和降低成本。同…...

集丰照明|汽车美容店设计,装修色彩灯光搭配方法

正确处理好店面的空间设计。 店铺各个功能区设计要合理&#xff0c;衔接合理&#xff0c;这样既能提高员工的工作效率也能提高顾客的满意度。合理安排店铺的空间分配&#xff0c; 要给顾客一种舒适度&#xff0c;既不能让顾客感觉到过于拥挤&#xff0c;又不能浪费店铺的有限空…...

性能提升3-4倍!贝壳基于Flink + OceanBase的实时维表服务

作者介绍&#xff1a;肖赞&#xff0c;贝壳找房&#xff08;北京&#xff09;科技有限公司 OLAP 平台负责人&#xff0c;基础研发线大数据平台部架构师。 贝壳找房是中国最大的居住服务平台。作为居住产业数字化服务平台&#xff0c;贝壳致力于推进居住服务的产业数字化、智能…...

取数组中每个元素的最高位

1 题目 /*程序将一维数组a中N个元素的最高位取出&#xff0c;保存在一维数组b的对应位置。 程序运行结果为&#xff1a; a&#xff1a;82 756 71629 5 2034 b: 8 7 7 5 2 */ 2 思考 简单来说就是取一个数据的最高位。 一开始的笨方法没有办法判断数据的长度&#xff0c;后来…...