KVM live migration and Using DFS As Storage

简介:

大约是在08年的时候,我曾经到一家代理VMWARE产品的公司面试过,公司人不多,但是非常有激情。当时与他们老板聊的也比较投缘,还应邀体验了一下他们公司周末的内部技术交流会议,后来由于其他原因放弃了去这家公司的机会。

那时候的话VMWARE已经有LIVE MIGRATION的成品了,当时的VMWARE热切换在存储方面应该是借助共享存储或ISCSI来实现的。

随着虚拟机技术的发展,出现了相当多的虚拟机产品(virtualBOX,virtualPC,XEN,KVM等等)当然还有小型机上的LPAR,DLPAR等等。

最近在测分布式文件系统,这个系统除了适合日志文件以外,我觉得还是可以拿来做虚拟机的操作系统实体。所以也来关心一下RHEL自带的虚拟机KVM。如果可以结合起来使用的话,无疑是一个相当廉价高效的解决方案。

分布式的文件系统这里就不描述了,在之前的博客文章里有描述过。

要做到活动迁移,其实还要考虑IP的迁移,二层交换中MAC地址的更新,(或者是MAC地址一同迁移)。

OK,让我们来看看RHEL6里面的描述:

Migration is name for the process of moving a virtualized guest from one host to another. Migration is a key feature of virtualization as software is completely separated from hardware. Migration is useful for:

(负载均衡)Load balancing – guests can be moved to hosts with lower usage when a host becomes overloaded.

(计划外切换)Hardware failover – when hardware devices on the host start to fail, guests can be safely relocated so the host can be powered down and repaired.

(计划内停机切换)Energy saving – guests can be redistributed to other hosts and host systems powered off to save energy and cut costs in low usage periods.

(跨地域切换)Geographic migration – guests can be moved to another location for lower latency or in serious circumstances.

Migrations can be performed live or offline. To migrate guests the storage must be shared. Migration works by sending the guests memory to the destination host. The shared storage stores the guest’s default file system. The file system image is not sent over the network from the source host to the destination host.

An offline migration suspends the guest then moves an image of the guests memory to the destination host. The guest is resumed on the destination host and the memory the guest used on the source host is freed.

The time an offline migration takes depends network bandwidth and latency. A guest with 2GB of memory should take an average of ten or so seconds on a 1 Gbit Ethernet link.

A live migration keeps the guest running on the source host and begins moving the memory without stopping the guest. All modified memory pages are monitored for changes and sent to the destination while the image is sent. The memory is updated with the changed pages. The process continues until the amount of pause time allowed for the guest equals the predicted time for the final few pages to be transfer. KVM estimates the time remaining and attempts to transfer the maximum amount of page files from the source to the destination until KVM predicts the amount of remaining pages can be transferred during a very brief time while the virtualized guest is paused. The registers are loaded on the new host and the guest is then resumed on the destination host. If the guest cannot be merged (which happens when guests are under extreme loads) the guest is paused and then an offline migration is started instead.

这段话描述了虚拟机活动迁移的过程,不一定所有的活动迁移都能成功,需要看目标物理机的资源情况和当时虚拟机的负载情况。

The time an offline migration takes depends network bandwidth and latency. If the network is in heavy use or a low bandwidth the migration will take much longer.

Live migration requirements

A virtualized guest installed on shared networked storage using one of the following protocols:

Fibre Channel

iSCSI

NFS

GFS2

Two or more Red Hat Enterprise Linux systems of the same version with the same updates.

Both system must have the appropriate ports open.

Both systems must have identical network configurations. All bridging and network configurations must be exactly the same on both hosts.

Shared storage must mount at the same location on source and destination systems. The mounted directory name must be identical.

Live KVM migration with virsh

# virsh migrate --live

GuestName DestinationURL

The 

GuestName

parameter represents the name of the guest which you want to migrate.

The 

DestinationURL

parameter is the URL or hostname of the destination system. The destination system must run the same version of Red Hat Enterprise Linux, be using the same hypervisor and have 

libvirt

running.

Once the command is entered you will be prompted for the root password of the destination system.

相关文章
|
15天前
|
Oracle 关系型数据库 Linux
Disable NUMA on database servers to improve performance of Linux file system utilities
Disable NUMA on database servers to improve performance of Linux file system utilities
18 3
|
存储 虚拟化 Windows