当前位置:文档之家› 分布式块存储介绍

分布式块存储介绍


2015/11/5
9
Sheepdog cluster
2015/11/5
10
整体架构
2015/11/5
11
2015/11/5
12
整体架构
• Sheepdห้องสมุดไป่ตู้g是一个分布式存储系统,它为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。
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.
2015/11/5
18
Object manager
• Path name rule: • 存放路径 • /store_dir/obj/[epoch number]/[object ID] • Write journaling 写日志 • 如果sheep 守护线程在写操作的时候失败,则只有部分对 • • •
2015/11/5
6
2015/11/5
7
2015/11/5
8
实例分析 ——开源分布式块存储sheepdog
• 开源的分布式块存储:2009年由日本NTT实验室MORITA •


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




计算机上。NAS 是部件级的存储方法,它的重点在于帮助工作组和部 门级机构解决迅速增加存储容量的需求。 DAS(Direct Attached Storage-直接附加存储) 是指将存储设备通过SCSI 接口或光纤通道直接连接到一台计算机上。 DAS 产品包括存储器件和集成在一起的简易服务器,可用于实现涉及 文件存取及管理的所有功能。 SAN(Storage Area Network-存储局域网络) 通过光纤通道连接到一群计算机上。在该网络中提供了多主机连接, 但并非通过标准的网络拓扑。SAN 专注于企业级存储的特有问题,主 要用于存储量大的工作环境。
相关主题