在Xen虚拟机pipe理程序中,如何正确处理Ubuntu服务器? 除了理论水平之外,我对RAID或Xen没有任何经验。
其他要求:
现在可能的想法是:
问题和顾虑:
注意:因为它可能对支持有影响,所以我指的是Ubuntu Server 10.04
回答:
如果你在Linux上使用软件raid,你应该为你的dom0实例创build一个分区,并为其余的硬盘创build一个大的分区。
然后,将这个大分区用作lvm物理驱动器,并且每个vm创build一个或多个lvm逻辑驱动器。
这使您可以轻松增加/减less特定逻辑驱动器的大小。
1. Ubuntu可以用作dom0 Xen主机吗?
在Xen 4.0 Dom0上设置Ubuntu 10.04 Server PV DomU
设置Libvirt 0.8.1和Xen 4.0.1 Dom0
2. XenServer可以安装mdadm等软件包并创build分区吗?
安装可能有点棘手,但我可能会工作。 XenServer使用RHEL 5和rhel框中的定制内核,您可以将ldd / path / to / mdadm并将所有链接的库复制到XenServer上完全相同的位置。 我可能会工作;)
** 3。 可以多个来宾访问(R + W)到相同的数据分区(RAID)吗?****
我相信你知道答案。
根据我的经验,我只是把细节留给libvirt。 它隐藏了我的虚拟化细节。 典型的设置是安装一个股票Ubuntu的,然后libvirt和MD工具。 假设你有你的RAID设备,确保它们在fdisk中有正确的系统(linux raid autodetect)。 启动fdisk,select分区/设备,使用t命令改变它的types。 下面显示了raid 1的一个例子。 将你的设置中的等级调整到5以获得RAID 5
root@mail:/etc/ldap# fdisk -l Disk /dev/sda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 2433 19543041 83 Linux /dev/sda2 2434 3042 4891792+ 83 Linux /dev/sda3 3043 3286 1959930 82 Linux swap / Solaris /dev/sda4 3287 9729 51753397+ fd Linux raid autodetect Disk /dev/sdb: 80.0 GB, 80032038912 bytes 255 heads, 63 sectors/track, 9730 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 2433 19543041 83 Linux /dev/sdb2 2434 3042 4891792+ 83 Linux /dev/sdb3 3043 3286 1959930 82 Linux swap / Solaris /dev/sdb4 3287 9729 51753397+ fd Linux raid autodetect **You may need to modprobe the right raid module** raid0 raid1 raid10 raid5 raid6 root@mail:/etc/ldap# modprobe raid1 **Create your array** root@mail:/etc/ldap# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda4 /dev/sdb4 mdadm: array /dev/md0 started. root@mail:/etc/ldap# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdb4[1] sda4[0] 51753280 blocks [2/2] [UU] [>....................] resync = 0.9% (466176/51753280) finish=14.6min speed=58272K/sec unused devices: <none> root@mail:/etc/ldap# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdb4[1] sda4[0] 51753280 blocks [2/2] [UU] [==>..................] resync = 11.5% (5956160/51753280) finish=13.6min speed=55983K/sec unused devices: <none>
你可以开始使用你的数组,即使它同步。 所以我们从lvm开始:通常,你需要设置一个PV,然后是一个vg,最后是你的LV。
使用pvcreate,VG和LV创build您的物理卷
# pvcreate /dev/md0 # vgcreate xen02 /dev/md0 # lvcreate -L 100G -n nosql.example.net.storage /dev/xen02
然后查看你的手艺
xen02:~# pvs PV VG Fmt Attr PSize PFree /dev/md0 xen02 lvm2 a- 462.49g 273.52g xen02:~# pvdisplay --- Physical volume --- PV Name /dev/md0 VG Name xen02 PV Size 462.50 GiB / not usable 3.81 MiB Allocatable yes PE Size 4.00 MiB Total PE 118398 Free PE 70022 Allocated PE 48376 PV UUID ,......... xen02:~# vgdisplay --- Volume group --- VG Name xen02 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 30 VG Access read/write VG Status resizable MAX LV 0 Cur LV 13 Open LV 9 Max PV 0 Cur PV 1 Act PV 1 VG Size 462.49 GiB PE Size 4.00 MiB Total PE 118398 Alloc PE / Size 48376 / 188.97 GiB Free PE / Size 70022 / 273.52 GiB VG UUID ,,,,,...... xen02:~# vgs VG #PV #LV #SN Attr VSize VFree xen02 1 13 0 wz--n- 462.49g 273.52g xen02:~# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert acme.example.net.root xen02 -wi-ao 15.00g ca.example.net.root xen02 -wi-ao 15.00g externalra.example.net.root xen02 -wi-ao 15.00g box2.example.net.root xen02 -wi-ao 15.00g
您现在可以使用libvirt来安装这样一个典型的LV(注意,您可以将virt-type从kvm更改为xen .. :)) – 您可能需要删除virtio参数,因为这是特定于KVM的。
virt-install --name=virtio_template \ --ram 1024 \ --os-type linux --os-variant debiansqueeze \ --disk path=/dev/xen02/nosql.example.net.storage,bus=virtio \ --network network=default,model=virtio \ --vnc \ --noautoconsole \ --cdrom ~/debian-testing-amd64-netinst.iso \ --virt-type kvm \ --force yes
我通常所做的就是创build一个模板虚拟机并将其克隆以创build工人虚拟机(–conect可能是kvm特定的):
#!/bin/sh # invoke as ./script "machine3" MACHINENAME="Somemachine" lvcreate -L 15G -n "$MACHINENAME".example.net.root /dev/xen02 echo Cloning template to $MACHINENAME virt-clone \ --prompt \ --connect qemu:///system \ --original template_master \ --name "$MACHINENAME" \ --file /dev/xen02/"$MACHINENAME".example.net.root
现在,您可以使用virsh命令获得乐趣。 看到它的帮助。
virsh start $MachineName virsh shutdown $MachineName
快乐的VM'ing