Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Kvm dynamic migration

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. on dynamic migration

Dynamic migration (Live Migration): also called online migration (Online Migration). It is the process of moving a virtual system from one physical host to another while ensuring the normal operation of services on the virtual machine. This process does not have a significant impact on the end user, thus enabling the administrator to repair or upgrade the physical server offline without affecting the normal use of the user.

Unlike static migration, in order to ensure the availability of virtual machine services during the migration process, the migration process has only a very short downtime. In the previous phase of the migration, the service runs on the virtual machine of the source host. When the migration reaches a certain stage, the destination host already has the necessary resources to run the virtual machine system. After a very short switch, the source host transfers control to the destination host, and the virtual machine system continues to run on the destination host. For the virtual machine service itself, because the switching time is very short, the user does not feel the interruption of the service, so the migration process is transparent to the user. Dynamic migration is suitable for situations that require high availability of virtual machine services.

Dynamic migration requires the original virtual machine image to be placed on a centralized shared external memory device such as SAN (storage area network) or NAS (network-attached storage). In this way, the entire hard disk image is not migrated, but the memory information is migrated, so it is faster and has less pause time.

Dynamic migration actually encapsulates the configuration of the virtual machine in a file, and then quickly transfers the configuration and memory running state of the virtual machine from one physical machine to another through the high-speed network, during which the virtual machine remains running. Under the existing technical conditions, most virtual machine software such as VMware, Hyper-V and Xen need to be supported by shared storage for dynamic migration. Typical shared storage includes a network file system with NFS and SMB/CIFS protocols, or a connection to a SAN network through ISCSI. Which network file system to choose depends on the specific situation. The experiment in this paper uses the NFS file system as the shared storage between the source host and the destination host.

Second, the experimental environment

1. The corresponding IP of a source host is 192.168.80.121.

2. The corresponding IP of a target host is 192.168.80.161.

3. The corresponding IP of a NFS shared storage is 192.168.80.100.

4. Three machines are bound to the same virtual network card

Third, set up NFS network file system

The source host and the target host are connected to the NFS server through the network card, and all the VM images are on the NFS Server. Then the VM1 is migrated from the source host to the target host and migrated through the network, so the speed of the network determines the speed of the migration.

Yum install nfs-utils / / install nfsmkdir-p / opt/kvmshare / / create a new shared directory vi / etc/exports / / modify files

/ opt/kvmshare 192.168.80.121 (rw,sync,no_root_squash)

/ opt/kvmshare 192.168.80.162 (rw,sync,no_root_squash)

/ opt/kvmshare / / is a shared folder

Rw: read and write permissions

Ro: read-only permission

No_root_squash: users who log in to the NFS host have ROOT permission if they are ROOT users. This parameter is not safe and is not recommended.

Sync: data is synchronously written to memory.

Async: the data will be temporarily stored in memory and will not be directly written to the hard disk.

Systemctl start rpcbind / / start systemctl start nfs / / and then start netstat-anpu | grep rpcbind / / UDP port 111is listening

Exportfs-av / / if a shared folder is displayed, the setting is already in effect

Upload the CentOS 7 image to the shared directory / opt/kvmshare after the construction is successful

4. Configure source host

1. Enable CPU virtualization (both need to be enabled)

2. Install the graphical interface (no graphical interface)

Yum groupinstall "GNOME Desktop"-y

After entering init 5: initial setup of centos linux 7 interface, enter: 1-2 colors-login-settings

3. Install the necessary tool plug-ins

Yum install-y\ qemu-kvm.x86_64\ qemu-kvm-tools.x86_64\ python-virtinst.noarch\ qemu-img.x86_64\ bridge-utils.x86_64\ libvirt\ virt-manager\ openssh-askpass

4. Verify whether the current host meets the running conditions of KVM.

Cat / proc/cpuinfo | egrep-o "vmx | smv" / / intel CPU filter vmx,AMD CPU filter smv

Modprobe kvm / / initialize lsmod | grep kvm / / check whether kvm virtualization is enabled successfully

5. Create a bridge network card

Vi / etc/sysconfig/network-scripts/ifcfg-ens33 / / add a new line at the end

BRIDGE= "br0"

Vi / etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0

BOOTPROTO=static

# NM_CONTROLLED=no

ONBOOT=yes

TYPE=Bridge

IPADDR=192.168.80.121

NETMASK=255.255.255.0

Systemctl restart network

6. Open the virtual system manager

Or open the terminal and open it with virt-manager.

7. Create a new storage pool

8. Create a virtual machine

Waiting for the installation to succeed.

Configure the destination host

1. Enable cpu virtualization (step above)

2. Install the graphical interface (steps above)

3. Install the necessary tools (steps above)

4. Verify whether the current host meets the running conditions of KVM.

5. Create a bridge network card

Vi / etc/sysconfig/network-scripts/ifcfg-ens33 / / add a new line at the end

BRIDGE= "br0"

Vi / etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0

BOOTPROTO=static

# NM_CONTROLLED=no

ONBOOT=yes

TYPE=Bridge

IPADDR=192.168.80.161

NETMASK=255.255.255.0

Systemctl restart network

6. Add a storage pool (step above)

VI. Hot migration of virtual machines

1. Add the connection of the target host

2. Migrate virtual machines

Vi / etc/hostname / / modify the destination hostname

Vi / etc/hosts / / modify the corresponding mapping table

Restart the virtual machine

3. Go to the destination host for viewing

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report