xen的实时迁移
一、基本组件Xen包含三大部分:Hypervisor:直接运行于硬件之上,是Xen客户操作系统与硬件资源之间的访问接口。通过将客户操作系统与硬件进行分类,Xen管理系统可以允许客户操作系统安全,独立的运行在相同硬件环境之上。Domain 0:运行在Xen管理程序之上,具有直接访问硬件和管理其他客户操作系统的特权的客户操作系统。DomainU:运行在Xen管理程序之上的普通客户操作系统或业务操作系统,不能直接访问硬件资源(如:内存,硬盘等),但可以独立并行的存在多个。
二、拓扑图
三、安装xen
1、190部署xen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# yum install centos-release-xen
# yum install xen
vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:You have a /boot partition.This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.18.17-13.el6.x86_64)
root (hd0,0)
kernel /xen.gz dom0_mem=1024M,max:1024M loglvl=all guest_loglvl=all
module /vmlinuz-3.18.17-13.el6.x86_64 ro root=UUID=9820b40c-2de5-4962-9407-6b99def9f5ed rd_NO_LUKSKEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
module /initramfs-3.18.17-13.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=9820b40c-2de5-4962-9407-6b99def9f5ed rd_NO_LUKSKEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img
重启系统,查看内核
# uname -r
3.18.17-13.el6.x86_64
2、创建桥设备
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
BRIDGE=br0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
~
# vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=10.1.2.200
NETMASK=255.255.225.0
GATEWAY=10.1.2.254
DNS1=114.114.114.114
IPV6INIT=no
USERCTL=no
~
四、配置iscsi 190服务器
1、
scsi-target-utils:用来将 Linux 系统仿真成为 iSCSI target 的功能;
iscsi-initiator-utils:挂载来自 target 的磁盘到 Linux 本机上。
iscsi-target-utils 主要提供哪些档案呢?基本上有底下几个比较重要需要注意的:
/etc/tgt/targets.conf:主要配置文件,设定要分享的磁盘格式与哪几颗;
/usr/sbin/tgt-admin:在线查询、删除 target 等功能的设定工具;
/usr/sbin/tgt-setup-lun:建立 target 以及设定分享的磁盘与可使用的客户端等工具软件。
/usr/sbin/tgtadm:手动直接管理的管理员工具 (可使用配置文件取代);
/usr/sbin/tgtd:主要提供 iSCSI target 服务的主程序;
/usr/sbin/tgtimg:建置预计分享的映像文件装置的工具 (以映像文件仿真磁盘);
1
# yum install iscsi-initiator-utils
2、设定 tgt 的配置文件 /etc/tgt/targets.conf
backing-store (虚拟的装置), direct-store (实际的装置): 设定装置时,如果你的整颗磁盘是全部被拿来当 iSCSI 分享之用,那么才能够使用 direct-store 。不过,根据网络上的其他文件, 似乎说明这个设定值有点危险的样子。所以,基本上还是建议单纯使用模拟的 backing-store 较佳。例如鸟哥的简单案例中,就通通使用 backing-store 而已。 initiator-address (用户端地址): 如果你想要限制能够使用这个 target 的客户端来源,才需要填写这个设定值。基本上,不用设定它 (代表所有人都能使用的意思), 因为我们后来会使用 iptables 来规范可以联机的客户端嘛! incominguser (用户账号密码设定): 如果除了来源 IP 的限制之外,你还想要让使用者输入账密才能使用你的 iSCSI target 的话,那么就加用这个设定项目。 此设定后面接两个参数,分别是账号与密码啰。 write-cache (是否使用快取): 在预设的情况下,tgtd 会使用快取来增快速度。不过,这样可能会有遗失数据的风险。所以,如果你的数据比较重要的话, 或许不要使用快取,直接存取装置会比较妥当一些。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# vim /etc/tgt/targets.conf
<target iqn.2015-10.com.qingyun:qingyundisk>
backing-store /dev/sdb1
</target>
# tgt-admin --show
Target 1: iqn.2015-10.com.qingyun:qingyundisk
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 345 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb1
Backing store flags:
Account information:
ACL information:
ALL
3、190客户端设置
要设定 iSCSI initiator 必须要安装 iscsi-initiator-utils 才行
/etc/iscsi/iscsid.conf:主要的配置文件,用来连结到 iSCSI target 的设定;
/sbin/iscsid:启动 iSCSI initiator 的主要服务程序;
/sbin/iscsiadm:用来管理 iSCSI initiator 的主要设定程序;
/etc/init.d/iscsid:让本机模拟成为 iSCSI initiater 的主要服务;
/etc/init.d/iscsi:在本机成为 iSCSI initiator 之后,启动此脚本,让我们可以登入 iSCSI target。所以 iscsid 先启动后,才能启动这个服务。为了防呆,所以 /etc/init.d/iscsi 已经写了一个启动指令, 启动 iscsi 前尚未启动 iscsid ,则会先呼叫 iscsid 才继续处理 iscsi
1
# yum install iscsi-initiator-utils
1
2
3
4
root@xenserver1 ~]# chkconfig iscsid on
# chkconfig iscsi on
# iscsiadm -m discovery -t sendtargets -p 10.1.2.190
10.1.2.190:3260,1 iqn.2015-10.com.qingyun:qingyundisk
开始进行联机 iSCSI target
1
# iscsiadm -m node -T iqn.2015-10.com.qingyun:qingyundisk -p 10.1.2.190 -l
查看iscsi磁盘
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb578102a
Device Boot Start End Blocks IdSystem
/dev/sda1 * 1 39 307200 83Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 12787 102400000 83Linux
/dev/sda3 12787 14827 16384000 82Linux swap / Solaris
Disk /dev/sdb: 42.9 GB, 42944154624 bytes
64 heads, 32 sectors/track, 40954 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
页:
[1]