KVM 热迁移

一、操作

  1. 关闭防火墙和SELinux
  2. 两台机器要做互相解析
  3. 同一个大版本的系统,从高版本系统上不可以往低版本系统上迁移,反过来可以。比如从6.5不能迁移到6.4,但是从6.4可以迁移到6.5
#将 KVM-A 上的虚拟机镜像文件所在的目录共享出来
[root@localhost ~]# vim /etc/exports
/var/lib/libvirt/images 192.168.1.2(rw,sync,no_root_squash)     #共享的路径,给谁共享,权限(读写,同步,不做root限制)

#启动nfs
[root@localhost ~]# systemctl start nfs

#配置文件生效
[root@localhost ~]# exportfs -r


#KVMB执行
[root@localhost ~]# systemctl start nfs

#将KVM-A上共享出来的目录挂载在到KVM-B的/var/lib/libvirt/images
[root@localhost ~]# mount 192.168.1.1:/var/lib/libvirt/images  /var/lib/libvirt/images
                                
#在KVM-B配置/etc/libvirt/qemu.conf
[root@localhost ~]# vim /etc/libvirt/qemu.conf          #取消下面选项的注释
user = "root"       第442行
group = "root"  第446行

[root@localhost ~]# systemctl restart libvirtd

1. 图形化界面迁移

需要安装服务

[root@localhost ~]# yum -y install openssh-askpass
image.png

image.png

image.png

image.png

image.png

image.png

image.png

2. 文本模式迁移

#需要安装服务
[root@localhost ~]# yum -y install openssh-askpass

[root@localhost ~]# virsh migrate --live vm1 --unsafe  qemu+ssh://192.168.1.2/system
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容