runsisi's

technical notes

Ceph块接口介绍

2019-01-02 runsisi#ceph#rbd

通用块设备

block

RBD应用

基本概念

  • pool(PG)/image

基本业务

  • thin-provisioning
  • read/write(offset, length)

增值业务

  • cow snapshot
  • clone

常规应用

  • 映射 RBD image 到本地
  • 通过网关导出为 SAN 或 NAS 存储

krbd

与 OpenStack 集成

  • Glance
  • Cinder
  • Nova

integrate

RBD服务端

rados plugin

/usr/lib64/rados-classes/libcls_rbd.so

元数据

rbd_directory		// all images registered
rbd_children		// parent -> child list
rbd_id.{image_name}		// id of image
rbd_header.{image_id}	// image metadata

用户数据

rbd_data.{image_id}.{64bit-seq}

RBD客户端

用户态 or 内核态

rbdc

librbd API

C/C++ 接口

http://docs.ceph.com/docs/master/rados/api/librados/
#include <rados/librados.h or hpp>
#include <rbd/librbd.h or hpp>

Python 绑定

http://docs.ceph.com/docs/master/rados/api/python/
http://docs.ceph.com/docs/master/rbd/api/librbdpy/
import rados
import rbd