1.Msgr.h文件:定义消息传输层的数据类型,以供ceph使用
(1)默认的监控端口:
#define CEPH_MON_PORT 6789
(2)客户端处理端口范围定义:
#define CEPH_PORT_FIRST 6789//监控
#define CEPH_PORT_START 6800 //开始
#define CEPH_PORT_LAST 6900//结束
(3)tcp协议标识和版本信息:
#define CEPH_BANNER "ceph v027"
#define CEPH_BANNER_MAX_LEN 30//最大长度
(4)ceph中的实体名称:在网络传输中使用,例如mds0表示元数据服务器0
struct ceph_entity_name {
__u8 type; /* CEPH_ENTITY_TYPE_* */
__le64 num;
} __attribute__ ((packed));//按照紧凑模式分配内存,而不是内存对齐
#define CEPH_ENTITY_TYPE_MON 0x01//监控服务器实体
#define CEPH_ENTITY_TYPE_MDS 0x02//元数据服务器实体
#define CEPH_ENTITY_TYPE_OSD 0x04//对象存储设备实体
#define CEPH_ENTITY_TYPE_CLIENT 0x08//客户端实体
#define CEPH_ENTITY_TYPE_AUTH 0x20//权限实体
#define CEPH_ENTITY_TYPE_ANY 0xFF//任何
同时提供一个函数用于将类型转换为名字字符串的函数如下:
const char *ceph_entity_type_name(int type)
{
switch (type) {
case CEPH_ENTITY_TYPE_MDS: return "mds";
case CEPH_ENTITY_TYPE_OSD: return "osd";
case CEPH_ENTITY_TYPE_MON: return "mon";
case CEPH_ENTITY_TYPE_CLIENT: return "client";
case CEPH_ENTITY_TYPE_AUTH: return "auth";
default: return "unknown";
}
}
(5)实体网络地址以及与名字实体的对应关系结构体
struct ceph_entity_addr {
__le32 type;
__le32 nonce; /* unique id for process (e.g. pid) */
struct sockaddr_storage in_addr;
} __attribute__ ((packed));
struct ceph_entity_inst {
struct ceph_entity_name name;
struct ceph_entity_addr addr;
} __attribute__ ((packed));
(6)消息交换协议定义:
#define CEPH_MSGR_TAG_READY 1 /* server->client: ready for messages */
#define CEPH_MSGR_TAG_RESETSESSION 2 /* server->client: reset, try again */
#define CEPH_MSGR_TAG_WAIT 3 /* server->client: wait for racing
incoming connection */
#define CEPH_MSGR_TAG_RETRY_SESSION 4 /* server->client + cseq: try again
with higher cseq */
#define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again
with higher gseq */
#define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */
#define CEPH_MSGR_TAG_MSG 7 /* message */
#define CEPH_MSGR_TAG_ACK 8 /* message ack */
#define CEPH_MSGR_TAG_KEEPALIVE 9 /* just a keepalive byte! */
#define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */
#define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */
#define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */
#define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */
(7)连接协商
struct ceph_msg_connect {//连接消息结构体
__le64 features; /* supported feature bits */支持的特征位
__le32 host_type; /* CEPH_ENTITY_TYPE_* */上面提到的实体类型
__le32 global_seq; /* count connections initiated by this host */主机初始化的连接数量
__le32 connect_seq; /* count connections initiated in this session */在这个对话中的连接数量
__le32 protocol_version;//协议版本
__le32 authorizer_protocol;//权限协议
__le32 authorizer_len;//权限长度
__u8 flags; /* CEPH_MSG_CONNECT_* */
} __attribute__ ((packed));
struct ceph_msg_connect_reply {//连接回复消息结构体
__u8 tag;//上面定义传递消息的类型
__le64 features; /* feature bits for this session */这个对话的特征位
__le32 global_seq;
__le32 connect_seq;
__le32 protocol_version;
__le32 authorizer_len;
__u8 flags;
} __attribute__ ((packed));
#define CEPH_MSG_CONNECT_LOSSY 1 /* messages i send may be safely dropped */
(8)消息头部结构:有老的
struct ceph_msg_header_old {
__le64 seq; /* message seq# for this session */消息序列号
__le64 tid; /* transaction id */传输id
__le16 type; /* message type */消息类型
__le16 priority; /* priority. higher value == higher priority */优先级,值高优先级就高
__le16 version; /* version of message encoding */消息编码版本
__le32 front_len; /* bytes in main payload */开头主要的有效数据的长度
__le32 middle_len;/* bytes in middle payload */
__le32 data_len; /* bytes of data payload */数据
__le16 data_off; /* sender: include full offset;
receiver: mask against ~PAGE_MASK */
struct ceph_entity_inst src, orig_src;
__le32 reserved;
__le32 crc; /* header crc32c */
} __attribute__ ((packed));
struct ceph_msg_header {
__le64 seq; /* message seq# for this session */
__le64 tid; /* transaction id */
__le16 type; /* message type */
__le16 priority; /* priority. higher value == higher priority */
__le16 version; /* version of message encoding */
__le32 front_len; /* bytes in main payload */
__le32 middle_len;/* bytes in middle payload */
__le32 data_len; /* bytes of data payload */
__le16 data_off; /* sender: include full offset;
receiver: mask against ~PAGE_MASK */
struct ceph_entity_name src;
/* oldest code we think can decode this. unknown if zero. */
__le16 compat_version;
__le16 reserved;
__le32 crc; /* header crc32c */
} __attribute__ ((packed));
#define CEPH_MSG_PRIO_LOW 64
#define CEPH_MSG_PRIO_DEFAULT 127
#define CEPH_MSG_PRIO_HIGH 196
#define CEPH_MSG_PRIO_HIGHEST 255
(9)数据有效载荷结构
struct ceph_msg_footer {
__le32 front_crc, middle_crc, data_crc;
__u8 flags;
} __attribute__ ((packed));
#define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */
#define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */
分享到:
相关推荐
ceph read
自下向上,可以将Ceph系统分为四个层次:顾名思义,这一层本身就是一个完整的对象存储系统,所有存储在Ceph系统中的用户数据事实上最终都是由这一层来存储的。而Ceph的高可靠、高可扩展、高性能、高自动化等等特性...
分布式存储Ceph中PG各种状态详解.docx
Ceph热点技术介绍2 Ceph热点技术介绍2 Ceph热点技术介绍2
Vault2017峰会上的Ceph热点技术介绍,Vault2017峰会上的Ceph热点技术介绍
Ceph优化:用SSD做缓存池方案详解
Ceph 存储架构和管理Ceph125学习实验环境,网盘文件永久链接
Learning Ceph.pdf Ceph Cookbook.pdf Ceph技能树 学习ceph的神器
ceph数据流分析知识
Ceph的主要目标是设计成基于POSIX的没有单点故障的分布式文件系统,使数据能容错和无缝的复制。2010年3 月,Linus Torvalds将Ceph client合并到内 核2.6.34中。IBM开发者园地的一篇文章 探讨了Ceph的架构,它的容错...
ceph tell osd.* injectargs '--ms_nocrc ' ceph tell osd.* injectargs '--osd_max_write_size 1024 ' ceph tell osd.* injectargs '--osd_max_pgls 10240' ceph tell osd.* injectargs '--osd_op_threads 24' ceph...
ceph分布式存储的入门级,安装、部署,并通过和gluster文件存储对比,体现ceph存储的高效解决方案。
文档是高清中文版pdf,详细介绍了ceph crush算法
ceph简介,系统层次结构,ceph的部署,ceph的应用,ceph的运维,基于ceph构建私有云存储方案
Ceph Cookbook 中文版
Ceph数据读写的原理与实现PPT教学课件.pptx
1. ceph.pdf:ceph知识树结构思维图 2. Ceph架构剖析.pdf:总结了CEPH整体架构 3. Ceph Cookbook.pdf:《Ceph Cookbook》中文版,目录、内容清晰 4. Learning Ceph.pdf:《Learning Ceph》英文电子版,目录、内容...
第1章 Ceph整体架构 1.1 Ceph的发展历程 1.2 Ceph的设计目标 1.3 Ceph基本架构图 1.4 Ceph客户端接口 1.4.1 RBD 1.4.2 CephFS 1.4.3 RadosGW 1.5 RADOS 1.5.1 Monitor 1.5.2 对象存储 1.5.3 pool和PG的...
ceph数据的分布及存储
ceph的强大可以改变您公司的IT基础架构和海量数据管理能力。ceph可提供极大的伸缩性—— 供成千用户访问PB乃至EB级的数据它用普通硬件和智能守护进程来构成大量存储主机靠相互通讯来复 制数据、并动态地重分布...