KVM Virtualization Notes (13)------A static migration of KVM virtual machines

Source: Internet
Author: User

1. Static migration is the virtual machine in the shutdown state, copy the virtual machine virtual disk files and configuration files to the target virtual host, the implementation of the migration. is divided into the following situations:

(1) The virtual host uses local storage to store the virtual machine disk files ( This article implements the migration method based on the local disk storage virtual machine disk files)

(2) use shared storage between virtual hosts to hold virtual machine disk files ( This is just a way to redefine the virtual machine on the target virtual host)

2, the process of static migration is as follows:

(1) To determine that the virtual machine is turned off, this article takes HADOOP3 as an example:

[[Email protected] install]# virsh list --all id    name                              State---------------------------------------------------- 1     win7                             running 18    hadoop4                          running 20    hadoop2                         running  21    hadoop1       &nbsP;                running  -     hadoop3                         shut off[[email  protected] install]#

(2) Prepare to migrate the virtual machine to view the virtual machine's disk configuration file

[Email protected] install]# Virsh domblklist hadoop3target Source------------------------------------------------HDA/IMAGES/TEST/HADOOP3.QCOW2HDB/IMAGES/TEST/HADOOP3 _ADD.QCOW2HDC-[[email protected] install]#

(3) Import the virtual machine configuration file

[Email protected] install]# Virsh dumpxml hadoop3 >/tmp/hadoop3.xml[[email protected] install]# ll/tmp/hadoop3*-rw- r--r--1 root root 3016 Feb 6 12:43/tmp/hadoop3.xml[[email protected] install]#

(4) Copy the configuration file to the target host

[Email protected] install]# scp/tmp/hadoop3.xml [email protected]:/etc/libvirt/qemuthe authenticity of host ' 10.1.156.211 (10.1.156.211) ' can ' t be established. RSA key fingerprint is 20:8E:24:A6:EF:B3:D6:71:72:BB:39:E7:88:F9:38:CD. Is you sure want to continue connecting (yes/no)? yeswarning:permanently added ' 10.1.156.211 ' (RSA) to the list of known hosts. [email protected] ' s password: [[email protected] install]#

(5) Copy the virtual machine's disk file to the target host

[[Email protected] install]# scp /tmp/hadoop3.xml [email protected]:/etc/libvirt /qemuthe authenticity of host  ' 10.1.156.211  (10.1.156.211) '  can ' t be  Established. RSA KEY FINGERPRINT IS 20:8E:24:A6:EF:B3:D6:71:72:BB:39:E7:88:F9:38:CD. are you sure you want to continue connecting  (yes/no)?  yesWarning : permanently added  ' 10.1.156.211 '   (RSA)  to the list of known  hosts. [email protected] ' s password: [[email protected] install]# virsh domblklist  hadoop3                 Target     source------------------------------------------------hda         /images/test/hadoop3.qcow2hdb         /images/test/hadoop3_add.qcow2hdc        -[[email protected] install]#  scp /images/test/hadoop3.qcow2 /images/test/hadoop3_add.qcow2 [email protected]:/ Data/test/[email protected] ' s password:[[email protected] install]#

3, do the following on the target host:

(1) View the environment of the target virtual host

[Email protected] test]# Virsh list--all Id Name State------------------------------------- ---------------

(2) Modify the target host's configuration file.

[[email protected] test] #vi/etc/libvirt/qemu/hadoop3.xml

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7A/C7/wKiom1a1fKqw8f7jAAEI5SpCS1Q498.png "title=" 1.png " alt= "Wkiom1a1fkqw8f7jaaei5spcs1q498.png"/>

(3) Define a registered virtual host

[Email protected] test]# Virsh define/etc/libvirt/qemu/hadoop3.xml Domain hadoop3 defined from/etc/libvirt/qemu/ Hadoop3.xml

(4) Start and confirm the virtual machine

[Email protected] test]# Virsh list--all Id Name State------------------------------------- ----------------HADOOP3 shut Off[[email protected] test]# Virsh start Hadoop3domain hadoop3 s tarted


At this point, the static migration of the virtual machine succeeds

This article is from the "Breght Moon" blog, make sure to keep this source http://liqingbiao.blog.51cto.com/3044896/1741316

KVM Virtualization Notes (13)------A static migration of KVM virtual machines

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.