KVM--基于本地存储的动态迁移

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KVM--基于本地存储的动态迁移相关的知识,希望对你有一定的参考价值。

源主机:

[[email protected] ~]# yum install centos-release-qemu-ev   #<--生成yum源文件

[[email protected] yum.repos.d]# ll CentOS-QEMU-EV.repo 
-rw-r--r-- 1 root root 514 5月  10 22:33 CentOS-QEMU-EV.repo

[[email protected] yum.repos.d]# rpm -qa|grep kvm
libvirt-daemon-kvm-3.2.0-14.el7_4.9.x86_64
qemu-kvm-common-1.5.3-141.el7_4.6.x86_64
qemu-kvm-1.5.3-141.el7_4.6.x86_64

[[email protected] yum.repos.d]# vim CentOS-QEMU-EV.repo 
# CentOS-QEMU-EV.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/Virtualization for more
# information

[centos-qemu-ev]
name=CentOS-$releasever - QEMU EV
baseurl=http://mirror.centos.org/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization

[centos-qemu-ev-test]
name=CentOS-$releasever - QEMU EV Testing
baseurl=http://buildlogs.centos.org/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=0
enabled=0

[[email protected] yum.repos.d]# yum repolist

[[email protected] yum.repos.d]# yum install qemu-kvm-ev

[[email protected] ~]# rpm -qa |grep kvm
qemu-kvm-ev-2.9.0-16.el7_4.14.1.x86_64
libvirt-daemon-kvm-3.2.0-14.el7_4.9.x86_64
qemu-kvm-common-ev-2.9.0-16.el7_4.14.1.x86_64

[[email protected] ~]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # start centos7.1
域 centos7.1 已开始

virsh # migrate centos7.1 qemu+ssh://master.kvm.com/system --live --persistent --undefinesource --copy-storage-all --verbose     
[email protected]'s password: 
迁移: [100 %]

目标主机:

[[email protected] ~]# yum install centos-release-qemu-ev

[[email protected] yum.repos.d]# ll CentOS-QEMU-EV.repo 
-rw-r--r--. 1 root root 514 May 10 22:33 CentOS-QEMU-EV.repo

[[email protected] yum.repos.d]# vim CentOS-QEMU-EV.repo
# CentOS-QEMU-EV.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/Virtualization for more
# information

[centos-qemu-ev]
name=CentOS-$releasever - QEMU EV
baseurl=http://mirror.centos.org/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization

[centos-qemu-ev-test]
name=CentOS-$releasever - QEMU EV Testing
baseurl=http://buildlogs.centos.org/centos/$releasever/virt/$basearch/kvm-common/
gpgcheck=0
enabled=0
[[email protected] yum.repos.d]# yum repolist

[[email protected] yum.repos.d]# yum install qemu-kvm-ev

[[email protected] ~]# rpm -qa |grep kvm
qemu-kvm-ev-2.9.0-16.el7_4.14.1.x86_64
libvirt-daemon-kvm-3.2.0-14.el7_4.9.x86_64
qemu-kvm-common-ev-2.9.0-16.el7_4.14.1.x86_64
创建存储池
[[email protected] ~]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit
virsh # pool-define-as vm dir --target "/vm"
Pool vm defined

virsh # pool-start vm
Pool vm started

virsh # pool-autostart vm
Pool vm marked as autostarted

[[email protected] vm]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     centos7.1                      running
 -     centos6.7                      shut off
 -     centos6.7-1                    shut off
 -     centos6.7-2                    shut off

[[email protected] vm]# sar -n DEV 1 
Linux 3.10.0-514.el7.x86_64 (master.kvm.com)    05/17/2018      _x86_64_        (2 CPU)

11:42:05 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:42:06 AM     vnet1      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:42:06 AM      eth0  20938.00    402.00  30919.13     27.26      0.00      0.00      0.00
11:42:06 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:42:06 AM virbr0-nic      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:42:06 AM    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:42:06 AM     vnet0      0.00      0.00      0.00      0.00      0.00      0.00      0.00


以上是关于KVM--基于本地存储的动态迁移的主要内容,如果未能解决你的问题,请参考以下文章

基于本地存储的kvm虚拟机在线迁移

基于NFS共享存储kvm虚拟机动态迁移操作梳理

基于NFS共享存储实现KVM虚拟机动态迁移

KVM虚拟化笔记(十四)------kvm虚拟机动态迁移

kvm虚拟化学习笔记(十四)之kvm虚拟机静态迁移

KVM热迁移虚拟机