一种虚机lvm动态迁移方法
来源:互联网 发布:网络教学设计原则 编辑:程序博客网 时间:2024/05/29 09:25
1. 配置文件中开启迁移
# (xend-relocation-hosts-allow '')
# (xend-relocation-port 8002)
# (xend-relocation-address '')
# (xend-relocation-server yes)
The problem
The Xen documentation on live migration states:
Currently, there is no support for providing automatic remote access to filesystems stored on local disk when a domain is migrated. Administrators should choose an appropriate storage solution (i.e. SAN, NAS, etc.) to ensure that domain filesystems are also available on their destination node. GNBD is a good method for exporting a volume from one machine to another. iSCSI can do a similar job, but is more complex to set up.
This does not mean that it is impossible though. Live migration is a more efficient migration, and migration can be seen as a save on one node, and a restore on another. Normally, if you save a VM on one machine, and try to restore it on another machine, it will fail when it is unable to read its filesystems. But what would happen if you coppied the filesystem to the other node between the save and restore? If done right, it works pretty well.
The solution?
The solution is simple:
- Save running image
- Sync disks
- copy image to other node, restore
This can be somewhat sped up by syncing the disks twice:
- Sync disks
- Save running image
- Sync disks - only having to save any changes in the last few seconds
- copy image to other node, restore
Syncronizing block devices
File backed
If you are using plain files as vbds, you can sync the disks using rsync.
Raw devices
If you are using raw devices, rsync can not be used. I wrote a small utility called [[blocksync|/programs/blocksync.py]] which can syncronize 2 block devices over the network. In my testing it was easily able to max out the network on an initial sync, and max out the disk read speed on a resync.
$ blocksync.py /dev/xen/vm-root 1.2.3.4
Will sync /dev/xen/vm-root onto 1.2.3.4. The device should already exist on the destination and be the same size.
Solaris ZFS
If you are using ZFS, it should be possible to use zfs send
to sync the block devices before migration. This would give an almost instantaneous sync time.
Automation
ZFS send
support is not yet implemented.Example:
#migrating a 1G / + 128M swap over the network#physical machines are 350mhz with 64M of ram,#total downtime is about 3 minutesxen1:~# time ./migrate.sh test 192.168.1.2+ '[' 2 -ne 2 ']'+ DOMID=test+ DSTHOST=192.168.1.2++ xen_vbds.py test+ FILES=/dev/xen/test-root/dev/xen/test-swap+ main+ check_running+ xm list testName Id Mem(MB) CPU State Time(s) Consoletest 87 15 0 -b--- 0.0 9687+ sync_disk+ blocksync.py /dev/xen/test-root 192.168.1.2ssh -c blowfish 192.168.1.2 blocksync.py server /dev/xen/test-root -b 1048576same: 942, diff: 82, 1024/1024+ blocksync.py /dev/xen/test-swap 192.168.1.2ssh -c blowfish 192.168.1.2 blocksync.py server /dev/xen/test-swap -b 1048576same: 128, diff: 0, 128/128+ save_image+ xm save test test.dump+ sync_disk+ blocksync.py /dev/xen/test-root 192.168.1.2ssh -c blowfish 192.168.1.2 blocksync.py server /dev/xen/test-root -b 1048576same: 1019, diff: 5, 1024/1024+ blocksync.py /dev/xen/test-swap 192.168.1.2ssh -c blowfish 192.168.1.2 blocksync.py server /dev/xen/test-swap -b 1048576same: 128, diff: 0, 128/128+ copy_image+ scp test.dump 192.168.1.2:test.dump 100% 16MB 3.2MB/s 00:05+ restore_image+ ssh 192.168.1.2 'xm restore test.dump && rm test.dump'(domain(id 89)[domain info stuff cut out])+ rm test.dumpreal 6m6.272suser 1m29.610ssys 0m30.930s
参考:http://sysadmin.wikia.com/wiki/Live_migration_xen
- 一种虚机lvm动态迁移方法
- 一种数据库迁移的方法
- linux动态磁盘lvm配置的方法
- SQL迁移到MySQL的一种方法
- 一种在线系统数据迁移方法
- 渐进式迁移 — 保证稳定性的一种方法
- LVM动态磁盘简记
- lvm动态扩展硬盘
- LVM动态添加硬盘空间
- lvm 动态扩展卷
- 一种动态模拟示波器数据的方法
- 一种动态自适应集群的构建方法
- 动态初始化编号的一种方法
- 一种动态屏幕适配的方法
- 动态迁移
- Openstack不支持LVM后端的热迁移
- LVM---动态调整磁盘容量
- 动态调整磁盘容量(LVM)
- 交叉编译工具链为什么是arm-linux-而不是arm-linux-gcc
- 统计输入的字符!
- 新款MacBook Air U盘轻松装Windows 7
- fireFox IE刷新不提示
- Fedora9中VMwaretools安装
- 一种虚机lvm动态迁移方法
- C++ 随机数生成
- 为内核添加yaffs2文件系统支持
- 嵌入式根文件系统制作
- 【伪原创工具】伪原创工具有用吗?
- IIC总线协议
- 基于Mathematica进行矩阵公式的推导
- POJ2479 Maximum sum 最长连续子序列[DP]
- 15、从头学Android之机器人的意图之Intent的Action