Detailed description of the KVM virtual machine static and dynamic migration (graphic introduction) _KVM

Source: Internet
Author: User

This paper mainly introduces the static and dynamic migration of the KVM virtual machine, which is as follows:

One, KVM virtual machine static migration

1. The static migration is the virtual machine in the Shutdown state, copy virtual machine virtual disk files and configuration files to the target virtual host, the implementation of the migration.

(1) Virtual hosts use local storage to store virtual machine disk files

This article implements the migration of disk files based on local disk storage virtual machines,

(2) Use shared storage between virtual hosts to store virtual machine disk files

This is just a way to redefine the virtual machine on the target virtual host.

2. The static migration process is as follows
(1) Determine the virtual machine shutdown status

(2) Prepare to migrate the oeltest02 virtual machine, view the disk files of the virtual machine configuration
(3) Import virtual machine configuration file

[root@node1~]# virsh dumpxml oeltest02 >/root/oeltest02.xml


(4) Copy the configuration file to the target virtual host.
(5) View the virtual machine disk files and copy them to the destination virtual host.
Copying Virtual disk files

3. On the target virtual host

The virtual machine disk files and configuration files have already been copied to the destination virtual host. Start configuration and startup below.

(1) View the target virtual host environment.
View the virtual machine disk files, the directory structure is the same as the source virtual host.
(2) to define a registered virtual host

(3) Start the virtual host and confirm
This virtual machine static migration is complete.

Ii. Dynamic migration of KVM virtual machines

Compared to the need to copy virtual disk files in a static migration of a KVM virtual machine, a KVM virtual machine dynamically migrates without copying the virtual disk files, but the same directory structure virtual machine disk files need to be migrated to the virtual hosts, this part of this article is implemented through NFS, Of course, the GFS2 cluster file system can be used to realize, the dynamic migration of this paper is based on shared storage dynamic migration. There are two kinds of KVM dynamic migration, one is based on the dynamic migration of shared storage, one is based on the dynamic migration based on data block, need qemu-kvm-0.12.2 above version support, OEL6.3 version is qemu-kvm-0.12.1.2, other distributions may have support.

1. Virtualization Platform Architecture

2. Introduction of virtualized environment

(1) KVM Virtualization Server Node1

Operating system version: Oel6.3x64
KVM Virtualization: Self-with version
Bridging IP Address 1:192.168.159.150
Test Virtual machine: oeltest01
Virtual machine IP Address: 192.168.159.132
Virtual Disk File 1:/data/test01.qcow2
Virtual Disk File 2:/data/test01_add01.qcow2
NFS Mount directory:/data

(2) KVM Virtualization Server Node2

Operating system version: Oel6.3x64
KVM Virtualization: Self-with version
Bridging IP Address 1:192.168.159.160
NFS Mount directory:/data

(3) Server for NFS (NFS configuration slightly)

Operating system version: Oel5.8x64
Bridging IP Address 1:192.168.169.180

NFS Services Directory:/MNT/VG/NFS/ABC

3.KVM Virtual Host Configuration Preparation
(1) Node 1 Mount NFS Directory
(2) Node 2 Mount NFS Directory
Make sure both nodes have the same virtual machine disk file storage directory.

4.KVM Virtual Machine Migration

(1) Node 1 virtual machine state, oeltest01 virtual machine boot state
(2) Node 2 virtual machine State, no virtual machine running
(3) Execute Migration command on Host 1

[root@node1~] #virsh migrate--live--verbose oeltest01
qemu+ssh://192.168.159.160/system tcp://192.168.159.160 root@192.168.159.160 ' Spassword:
migration:[100%]


The procedure has a pause and shutdown process.

(4) The client has been ping to view the migration, you can see that there are two packets in the middle of the interrupt, basically not much impact.
(5) on the virtual Host 2, you can see that the virtual machine oeltest01 has been started.
Although the oeltest01 virtual machine has been started on Node 2, there is no oeltest01 virtual machine configuration file on the virtual host. So you need to create a configuration file and define a virtual machine.

(6) on Virtual Host 2, the virtual machine configuration file is created by migrating the virtual machine memory state, and the virtual machine is defined through the XML configuration file.
There is no problem entering the virtual machine on virtual Host 2.
To this, the KVM virtual machine dynamic migration succeeded.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.