Dynamic migration of vms in Ubuntu 12.04 KVM-Based on LVM

Source: Internet
Author: User
Tags dell r710


Live Migration is also called Online Migration ). It is the process of moving a virtual machine system from one physical host to another while ensuring the normal operation of services on the virtual machine. Unlike static migration, to ensure the availability of Virtual Machine services during migration, the migration process has only a very short downtime.
Currently, the mainstream dynamic migration tools www.2cto.com rely on centralized shared external storage devices such as SAN (storage area network) or NAS (network-attached storage) between physical machines, therefore, you only need to migrate the execution status of the VM system memory during migration to achieve better migration performance.
Www.2cto.com has three dell R710 servers. Two hosts are installed with kvm virtual machines on the host machine. One is used to simulate shared storage through iscsi. The main experiment is the dynamic migration process of kvm VMS, the two hosts continue to use the static migration environment in the previous section. However, you need to install the iscsi client and install the iscsi server on the storage. The names of the three machines are: Ubuntu-src, Ubuntu-dst, and Ubuntu-store.
Install iscsi software: install the client 1apt-get install open-iscsi on Ubuntu-src and Ubuntu-dst and install the server 1apt-get install iscsitarget on Ubuntu-store. <span style = "background-color: # ffffff; "> iscsitarget-sourceiscsitarget-dkms </span> 1apt-get install module-assistant debhelper build-essential after the server is installed, the default service is not started, to modify the configuration file/etc/default/iscsitarget ISCSITARGET_ENABLE = false --> ISCSITARGET_ENABLE = true start iscsitarget: Use/dev/sda6 on Ubuntu-store as shared storage, modify/etc/iet/ietd. conf file, append the following configuration at the end of the file:
1 Target iqn.2012-10.com. guol: storage. lun12Lun 0 Path =/dev/sda6, Type = fileio get the shared storage resources on Ubuntu-src and connect to the server to view the shared storage resources: 1 iscsiadm-m discovery-t st-p 10.1.6.89 mount the shared storage resources provided by the server: 1 iscsiadm-m node2iscsiadm-m node-T iqn.2012-10.com. guol: storage. lun1-p 10.1.6.89: 3260-l partition on shared storage: You can see that shared storage resources are identified as/dev/sdb devices, divide the entire/dev/sda into/dev/sdb1 partitions and create a volume: www.2cto. com1pvcreate/dev/sdb12vgcreate store/dev/sdb13lvcreate-L 5G-n kvm-mig store on Ubuntu-src use virt-install to install the vm to the kvm-mig volume: www.2cto. com1virt-install-d-n kvm-mig-r 2048 -- disk path =/dev/store/kvm-mig, bus = virtio, cache = none -- network bridge = br0, model = virtio -- vnc -- cdrom =/opt/after the debian-6.0.2.1-amd64-CD-1.iso is installed, start the Virtual Machine and log on to view, such: get resources for shared storage 1 iscsiadm-m discovery-t st-p 10.1.6.892iscsiadm-m node3iscsiadm-m node-T iqn.2012-10.com on Ubuntu-dst. guol: storage. lun1-p 10.1.6.89: 3260 -lwww.2cto.com, for example:
Using fdisk-l, you can see that/edv/sdb1 divided on Ubuntu-src and the related lvm volumes start to dynamically migrate kvm-mig from Ubuntu-src to Ubuntu-dst.: first, check the status of the Virtual Machine on Ubuntu-src and Ubuntu-dst 1 virsh list

We can see that kvm-mig runs on Ubuntu-src, but not on Ubuntu-dst. Next, we will dynamically migrate kvm-mig on Ubuntu-src to Ubuntu-dst. Run the following command on Ubuntu-src to log on with the ssh key before Ubuntu-src and Ubuntu-dst in advance, and ensure that the domain name resolution is correct. You can set/etc/hosts. 1 virsh migrate -- live kvm-mig qemu + ssh: // 10.1.6.228/system: Wait about 1 ~ 2 minutes, the migration time depends on the memory used by the virtual machine, because dynamic migration only copies the memory in the source to the target machine. The results are as follows:
 


We can see that kvm-mig is running on Ubuntu-src. A few minutes later, kvm-mig will be moved to Ubuntu-dst,
However, it is in the abort state at the beginning, and will change to running state in a few seconds. Log on to the kvm-mig VM at www.2cto.com on Ubuntu-dst: there is a problem. To use virsh for migration, just copy the memory to the target machine, the STARTUP configuration file is not copied to the target host. Therefore, if the virtual machine is disabled, it cannot be started again on the target host, to enable the migrated virtual machine on the target machine, copy the virtual machine configuration files in the/etc/libvirt/qemu directory of the source host to the target machine.
 

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.