1、数据流走向:
client -> dns -> cdn(cache) -> LB+HA -> web server -> tomcat -> db -> storage
2、封装7.6版本虚拟机
[root@foundation50 images]# cd /isos/ 镜像存放位置
[root@foundation50 isos]# ls
rhel-8.2-x86_64-dvd.iso rhel-server-7.6-x86_64-dvd.iso
禁掉selinux
禁掉防火墙
将selinux改称disabled
配置网络
宿主机为双ip
[root@foundation50 isos]# ip addr show
虚拟机网关为宿主机上的ip
启动网络
配置rhel7.6 yum源
安装基础软件
做解析
vim /etc/hosts
poweroff 关机
[root@foundation50 isos]# cd /var/lib/libvirt/images/
[root@foundation50 images]# ls
base.qcow2
[root@foundation50 images]# du -h base.qcow2
21G base.qcow2 base有21个G比较占空间
[root@foundation50 images]# yum install libguestfs-tools 安装清理命令的包
[root@foundation50 images]# virt-sysprep -d base 清理缓存临时等文件,-d 后面跟域名 base ,而不是镜像名
[ 0.0] Examining the guest ...
[ 20.2] Performing "abrt-data" ...
[ 20.2] Performing "backup-files" ...
[ 21.1] Performing "bash-history" ...
[ 21.1] Performing "blkid-tab" ...
[ 21.1] Performing "crash-data" ...
[ 21.1] Performing "cron-spool" ...
[ 21.1] Performing "dhcp-client-state" ...
[root@foundation50 images]# virt-sparsify --compress base.qcow2 rhel7.6-base.qcow2 压缩 ,压缩后的新名字为rhel7.6-base.qcow2
[ 0.0] Create overlay file in /tmp to protect source disk
[ 0.1] Examine source disk
[ 3.0] Fill free space in /dev/rhel/root with zero
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 193.2] Clearing Linux swap on /dev/rhel/swap
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 199.1] Fill free space in /dev/sda1 with zero
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[ 212.8] Copy to destination and make sparse
[ 517.8] Sparsify operation completed with no errors.
virt-sparsify: Before deleting the old disk, carefully check that the
target disk boots and works correctly.
[root@foundation50 images]# rm -f base.qcow2 删除
[root@foundation50 images]# qemu-img creat -f qcow2 -b rhel7.6-base.qcow2 vm1
qemu-img: Command not found: creat
Try 'qemu-img --help' for more information
[root@foundation50 images]# qemu-img create -f qcow2 -b rhel7.6-base.qcow2 vm1 创建虚拟机
Formatting 'vm1', fmt=qcow2 size=21474836480 backing_file=rhel7.6-base.qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@foundation50 images]# qemu-img create -f qcow2 -b rhel7.6-base.qcow2 vm2 创建虚拟机
Formatting 'vm2', fmt=qcow2 size=21474836480 backing_file=rhel7.6-base.qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@foundation50 images]# qemu-img create -f qcow2 -b rhel7.6-base.qcow2 vm3 创建虚拟机
Formatting 'vm3', fmt=qcow2 size=21474836480 backing_file=rhel7.6-base.qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
依次类推可以创建多台虚拟机,创建虚拟机只需更改网络和主机名