助教讲义

Download Report

Transcript 助教讲义

《网络存储与系统虚拟化技术》实验
洪星星 [email protected]
李涛 [email protected]
高博 [email protected]
1
提纲
 普通实验
 RAID环境搭建
 NAS (NFS) 环境搭建
 KVM虚拟化平台及VM安装
 虚拟机基本操作与迁移
 虚拟化性能评测
 开放实验
 虚拟化集群监控系统设计
 Openstack, KVM中Ceph, Sheepdog镜像存储方
式性能对比
 VM镜像文件优化研究
http://ncis.pku.edu.cn
普通实验1——RAID环境搭建
 实验目标
 基于CentOS平台用Mdadm软件实现RAID1和
RAID5
 使用Mdadm操作(create, manage, etc.)
 理解RAID原理
 完成实验报告
 参考文献

http://en.wikipedia.org/wiki/Mdadm

http://toplab.sinaapp.com/2012/04/13/mdadm%E8%AF%A6%E7%BB%86
%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C/
http://ncis.pku.edu.cn
普通实验1——Mdadm命令
 Create an array

mdadm --create /dev/md0 --level=mirror --raid-devices=2
/dev/sda1 /dev/sdb1
 Growing an array by adding devices


mdadm --add /dev/md1 /dev/sdd1
mdadm --grow /dev/md1 --raid-devices=4
 Deleting an array



mdadm --stop /dev/md0 # to halt the array
mdadm --remove /dev/md0 # to remove the array
mdadm --zero-superblock /dev/sd[abc]1 # delete the
superblock from all drives in the array
http://ncis.pku.edu.cn
普通实验2——NFS环境搭建
 实验目标
 基于CentOS平台配置NFS Server和NFS Client
 使用benchmark评测NFS性能
 完成实验报告
 参考文献

http://nfs.sourceforge.net/nfs-howto/

http://www.server-world.info/en/note?os=CentOS_5&p=nfs

https://www.digitalocean.com/community/articles/how-to-set-up-an-nfsmount-on-centos-6

http://www.iozone.org/docs/NFSClientPerf_revised.pdf

http://sourceforge.net/projects/nfstestmatrix/
http://ncis.pku.edu.cn
普通实验2——NFS配置
普通实验3——KVM平台及VM安装
 实验目标
 基于CentOS安装KVM, libvirt
 virt-install安装虚拟机(VM)
 安装spice连接VM桌面
 完成实验报告
 参考文献

https://access.redhat.com/site/documentation/enUS/Red_Hat_Enterprise_Linux/5/html/Virtualization/sect-VirtualizationInstalling_the_virtualization_packagesInstalling_KVM_packages_on_an_existing_Red_Hat_Enterprise_Linux_syste
m.html
http://ncis.pku.edu.cn
普通实验3——安装KVM和VM
 Installing the KVM hypervisor with yum
yum install kvm
 Install the other recommended virtualization packages
yum install virt-manager libvirt libvirt-python python-virtinst
 Creating guests with virt-install
virt-install --accelerate --hvm --connect qemu:///system \
--network network:default \
--name rhel3support --ram=756\
--file=/var/lib/libvirt/images/rhel3support.img \
--file-size=6 --vnc --cdrom=/dev/sr0
http://ncis.pku.edu.cn
普通实验4——虚拟机基本操作与迁移
 实验目标
 使用virsh命令操作虚拟机,如start, destroy等
 使用virsh或virt-manager等工具迁移虚拟机
 qemu-img创建Qcow2镜像,配置XML以启动VM
 完成实验报告
 参考文献

https://access.redhat.com/site/documentation/enUS/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/c
hap-Virtualization_Administration_Guide-KVM_live_migration.html

http://virt-manager.org/

https://access.redhat.com/site/documentation/zhCN/Red_Hat_Enterprise_Linux/5/html/Virtualization/ch-virt-task-virsh.html
http://ncis.pku.edu.cn
Libvirt XML
http://ncis.pku.edu.cn
Virsh命令
http://ncis.pku.edu.cn
普通实验5——虚拟化性能评测
 实验目标
 在Win7虚拟机中安装应用软件以体验VM性能
 在Linux虚拟机中运行benchmark评测性能
 测试NFS存储环境下的VM性能
 完成实验报告
 参考文献

http://www.spec.org/
http://ncis.pku.edu.cn
开放实验1——虚拟化集群监控系统设计
1. 为便于管理员管理pVEE,管理员需要实时监测pVEE的
运行状态,并自动化监控、预警甚至修复pVEE系统故障:

Host实时的CPU使用率,内存使用率,网络状况,IO等设备状况

Host运行的虚拟机(VM)的VCPU,内存,网络状态,VM操作系统类型,
VM资源配置信息,设备信息

Host基本镜像存储及File Server增量镜像存储的容量状况

Host宕机或VM dump

Hypervisor运行状况异常(如VM启动失败)

VM桌面连接失效(如Spice客户端连接VM桌面失败)

VM镜像磁盘块读写错误

pVEE管理工具运行错误
http://ncis.pku.edu.cn
开放实验1——虚拟化集群监控系统设计
2. pVEE作为教学实验环境,为改善其用户体验,我们需
收集、分析用户利用VM参与上机活动时相关性能数据,根
据监控反馈完善pVEE:

学生在VM中使用课程应用的响应延迟(如使用VC编写程序)

学生在VM中在线提交作业的网络延迟(如提交online judge代码)

学生使用课程VM的学期中,个性化镜像增长状况与VM系统启动时间

学生课堂上机时段,个性化镜像存储服务器的压力状况

如果VM使用出现性能问题,能根据监测结果定位到关键原因
http://ncis.pku.edu.cn
开放实验2——Openstack, KVM中Ceph,
Sheepdog镜像存储方式性能对比
 研究目标(任选以下一种)
 对比openstack cinder不同存储方式的性能
 Ceph
 Sheepdog
 对比KVM使用不同存储方案的性能
 Ceph
 sheepdog
 参考文献




http://docs.openstack.org/developer/cinder/
http://ceph.com/docs/next/rbd/rbd-openstack/
https://github.com/sheepdog/sheepdog
http://www.sebastien-han.fr/blog/2012/06/10/introducing-cephto-openstack/
http://ncis.pku.edu.cn
开放实验3——VM镜像文件优化研究
 研究背景
 增量镜像增长过快
目前增量镜像的存储格式为qcow2格式,在测试的应用当
中,发现qcow2格式镜像的增长过快,初始化的增量大小很
小,但是随着时间的增长,增量镜像的数量级可能达到10GB左
右,甚至更大,这不仅会导致存储服务器端的存储容量过大,
并且在实际应用中,密集的镜像下载上传过程,不仅会影响存
储服务器的响应时间,并且加大网络传输延迟
 相同课程增量镜像之间内容重合较多
由于课程要求均相同,所以用户使用虚拟机的行为类似,在增
量镜像当中会有大量相同的用户数据,占用空间较大,增量镜
像的个性化不明显。
http://ncis.pku.edu.cn
开放实验3——VM镜像文件优化研究
 研究目标
 优化增量镜像文件写入机制,在qcow2格式中
加入标记模块,标记用户冗余数据。
 分析相同课程的增量镜像之间的重复度,提取
出增量镜像之间的公共部分,改变增量镜像地
址索引模式,从基本镜像+增量镜像的启动模式
变为基本镜像+公共部分+增量镜像的启动模式
http://ncis.pku.edu.cn
开放实验3——VM镜像文件优化研究

Qcow2格式简介
Typedef struct QCowHeader{
 uint32_t magic;
 uint32_t version;
 uint64_t backing_file_offset;
 uint32_t backing_file_size;
 uint32_t cluster_bits;
 uint64_t size; /*in bytes*/
 uint32_t crypt_method;
 uint32_t l1_size;
 uint64_t l1_table_offset;
 uint64_t refcount_table_offset;
 uint32_t refcount_table_clusters;
 uint32_t nb_snapshots;
 uint64_t snapshots_offset;
}QCowHeader;
http://ncis.pku.edu.cn
Qcow2格式文件起始处有专门的
区域存放元数据,支持一些高级
特性,如加密,压缩和快照,以
节省磁盘空间并保证数据安全
开放实验3——VM镜像文件优化研究
Qcow2二级页表机制
Qcow2 文件存储数据的基本单元是
cluster,每一个cluster 由若干个
数据扇区组成,每个数据扇区的大
小是512 字节。在qcow2 中,要定
位镜像文件的cluster,需要经过两
次地址查询操作,类似于主存二级
页表转换机制
http://ncis.pku.edu.cn
Q&A
http://ncis.pku.edu.cn