分布式块存储介绍

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
the usage of lower 32 bits
theBaidu Nhomakorabeaindex number in the virtual disk image not used (filled with zero) the index number in the vm state image the hash value of the key name
2015/11/5
4
概念2 块存储
• 块设备:各类磁盘; • 块层:linux • 存储虚拟化 • RAID • Qemu 虚拟盘
2015/11/5
5
概念3 网络存储
• NAS(Network Attached Storage-网络附加存储)
• 即将存储设备通过标准的网络拓扑结构(例如以太网),连接到一群
2015/11/5
13
节点内部
2015/11/5
Object Storage
14
• 每个对象都有一个全局唯一的64位标识,对象可以存在多个节点



• • •
上。QEMU block driver并不关心对象的存储位置。对象存储系统 负责管理对象的存储位置。 Object 类型:data object、vdi object(虚拟盘镜像)、vmstate object(运行的虚拟机的虚拟机状态镜像,用来做快照)、vdi attr object(每个虚拟盘的属性,属性为key-value风格,类似于常 用文件系统的扩展属性) Object ID 规范: 0 - 31 (32 bits): object type specific space 32 - 55 (24 bits): vdi id 对VDI名计算hash值得到 56 - 59 ( 4 bits): reserved 60 - 63 ( 4 bits): object type identifier
2015/11/5
6
2015/11/5
7
2015/11/5
8
实例分析 ——开源分布式块存储sheepdog
• 开源的分布式块存储:2009年由日本NTT实验室MORITA •


• •
KAZUTAKA 创建的 专为虚拟机(QEMU/KVM虚拟机)提供块存储,但并不完 全拘泥于虚拟机,可提供一个虚拟的块设备 无单节点失效:如果一个节点失败,其数据可由其他节点 得到。 低运维开销:零配置;对内核文件系统无特性假设;节点 变化无须人工参与即可恢复;数据动态均衡负载;支持虚 拟机的热迁移、镜像快照、模版&克隆、集群快照; 计算节点和数据节点混合模式 线性扩展,支持上千级别节点

象会更新。 1. create a journal file "/store_dir/journal/[epoch]/[vdi object id]" 2. write a data to the journal file first 3. write a data to the vdi object 4. remove the journal file
2015/11/5
1
分布式块存储介绍
2015/11/5
2
分布式块存储
• 概念: • 采用分布式技术:多存储节点; • 操作: 块;
2015/11/5
3
概念1 分布式
• 分布式系统:硬件或软件组件分布在网络计算机上且通过 • •

• •
消息传递进行通信和动作协调的协调。 特征: 并发性 异构性 可伸缩性 透明性
2015/11/5
17
Gateway
• Where to store objects • •

• •

• •

consistent hashing:增删节点不会对对象映射产生改变; I/O 负载平衡 Replication 写冲突 Write I/O flow 所有副本必须成功更新 Read I/O flow 对象一致性:节点失效造成副本不一致。 Retrying I/O requests epoch:历史版本号
2015/11/5
16
• Read-only/writable objects • Writable:只允许一个VM读写此对象而其他VMs不能访问; • Read-only objects:可读但不能写 • 这是指虚拟机不能同一时间共享同一卷(volume)。这避
免了写写冲突,简化了sheepdog系统的实现。
2015/11/5
18
Object manager
• Path name rule: • 存放路径 • /store_dir/obj/[epoch number]/[object ID] • Write journaling 写日志 • 如果sheep 守护线程在写操作的时候失败,则只有部分对 • • •
object type
data object vdi object vmstate object vdi attr objects
2015/11/5
15
• • • • • • • • • • • • • • • • • • • • • •
Object 格式: Data object:虚拟盘镜像的chunk Vdi object: struct sheepdog_inode { char name[SD_MAX_VDI_LEN]; /* the name of this VDI*/ char tag[SD_MAX_VDI_TAG_LEN]; /* the snapshot tag name */ uint64_t ctime; /* creation time of this VDI */ uint64_t snap_ctime; /* the time snapshot is taken */ uint64_t vm_clock_nsec; /* vm clock (used for live snapshot) */ uint64_t vdi_size; /* the size of VDI */ uint64_t vm_state_size; /* the size of vm state (used for live snapshot) */ uint16_t copy_policy; /* reserved */ uint8_t nr_copies; /* the number of object redundancy */ uint8_t block_size_shift; /* info about the size of the data object */ uint32_t snap_id; /* the snapshot id */ uint32_t vdi_id; /* the vdi id */ uint32_t parent_vdi_id; /* the parent snapshot vdi id of this VDI */ uint32_t child_vdi_id[MAX_CHILDREN]; /* the children VDIs of this VDI */ uint32_t data_vdi_id[MAX_DATA_OBJS]; /* the data object IDs this VDI contains*/ }; Vmstate object:chunk Vdi attr object: The first SD_MAX_VDI_ATTR_KEY_LEN bytes (256 bytes) is the key name of this attribute. The rest of the object is the value of this attribute.




计算机上。NAS 是部件级的存储方法,它的重点在于帮助工作组和部 门级机构解决迅速增加存储容量的需求。 DAS(Direct Attached Storage-直接附加存储) 是指将存储设备通过SCSI 接口或光纤通道直接连接到一台计算机上。 DAS 产品包括存储器件和集成在一起的简易服务器,可用于实现涉及 文件存取及管理的所有功能。 SAN(Storage Area Network-存储局域网络) 通过光纤通道连接到一群计算机上。在该网络中提供了多主机连接, 但并非通过标准的网络拓扑。SAN 专注于企业级存储的特有问题,主 要用于存储量大的工作环境。
2015/11/5
21
VDI 操作
• • • • • • • • • • • • • •
Lookup calculate a vdi id from the hash value of the vdi name calculate a vdi object id from the vdi id send a read request to the vdi object if the vdi is not the requested one, increment the vdi id and retry to send a read request 快照和克隆 1. read a target VDI 2. create a new VDI which has the same content as the target object VDI 3. set the ''parent_vdi_id'' of the new VDI to the target VDI id 4. set the ''child_vdi_id'' of the target VDI to the new VDI id 5. set the ''snap_ctime'' of the target VDI to the current time then, the new vdi becomes the current vdi object. Delete reclaiming of unused data objects is not invoked until all relevant VDI objects (all relative snapshot VDIs and cloned VDIs) are deleted。 After all relevant VDIs are deleted, Sheepdog deletes all data objects of the VDIs, and set the null string to the name of the vdi objects.
2015/11/5
9
Sheepdog cluster
2015/11/5
10
整体架构
2015/11/5
11
2015/11/5
12
整体架构
• Sheepdog是一个分布式存储系统,它为sheepdog客户端(QEMU •




块设备驱动)提供一个object storage(对象存储),(类似于简 单的key-value接口)。 object storage :sheepdog并不是一般通用的文件系统。Sheepdog 守护线程(sheep)为QEMU创建一个分布式的对象存储系统。 对象可以存放在存储系统中。对象是大小可伸缩的,并且有一个 全局唯一标识。我们通过指定对象标识来进行读写删除等操作。 对象存储包括gateway和对象管理。 Gateway:gateway接受QEMU发送来的I/O请求(object id, offset, length, operation type),并根据一致性哈希算法来计算目标节点, 然后将请求发送至目标节点。 Object manager:object manager 接受到gateway发送来的I/O请求, 并对它的磁盘上进行读写操作。 Cluster manager:它管理node membership(节点之间的关系)例 如,检测失败或添加的节点和通知节点的变化,并且管理一些保 持节点一致性的操作,例如vdi创建以及快照等。目前我们采用 corosync cluster engine作为cluster manager。 QEMU block driver:它将一个VM镜像分成固定大小的object (4MB)并通过gateway将它们存放在object storage。
2015/11/5
19
Cluster manager
• 一般sheepdog客户端独立访问他们的镜像。而且一些VDI操
作(克隆、创建VDI)必须唯一的执行,因为这些操作更新 全局信息。 • Corosync cluster engine
2015/11/5
20
QEMU Block Driver
• Sheepdog卷被分成4MB的data objects。只有被写过的才分配。 • Open:QEMU块设备驱动通过gateway读一个vdi对象bdrv_open() • Read/wrte:根据请求扇区的偏移和大小计算data object id,然后将请求发送
到gateway。如果块设备驱动发送写请求至某个不属于当前VDI的数据对象, 则块设备驱动发送Cow请求来分配一个新的数据对象 • 写快照vdi:对QEMU附加一个快照VDI,当块设备驱动第一次将写请求发 送到块设备vdi时,则块设备驱动创建一个写的writeable VDI作为快照的孩 子,然后发送请求到这个新的VDI。
相关文档
最新文档