MogileFS DB 表结构
MogileFS数据库使用Innodb数据引擎
以下是所有表:
+----------------------+
| Tables_in_mogilefs |
+----------------------+
| class |
| device |
| domain |
| file |
| file_on |
| file_on_corrupt |
| file_to_delete |
| file_to_delete2 |
| file_to_delete_later |
| file_to_queue |
| file_to_replicate |
| fsck_log |
| host |
| server_settings |
| tempfile |
| unreachable_fids |
+----------------------+
d omain (域):用于记录域信息
+-----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------------------+------+-----+---------+-------+
| dmid | smallint(5) unsigned | NO | PRI | NULL | |
| namespace | varchar(255) | YES | UNI | NULL | |
+-----------+----------------------+------+-----+---------+-------+
class(类):用于记录各域中的类信息,对每个类可定义不同的备份策略
+-------------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------------------+------+-----+---------+-------+
| dmid | smallint(5) unsigned | NO | PRI | NULL | |
| classid | tinyint(3) unsigned | NO | PRI | NULL | |
| classname | varchar(50) | YES | | NULL | |
| mindevcount | tinyint(3) unsigned | NO | | NULL | |
| replpolicy | varchar(255) | YES | | NULL | |
+-------------+----------------------+------+-----+---------+-------+
host(存储节点):用于记录各存储节点状态和访问的ip和端口等
+---------------+-----------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-----------------------------+------+-----+---------+-------+
| hostid | mediumint(8) unsigned | NO | PRI | NULL | |
| status | enum('alive','dead','down') | YES | | NULL | |
| http_port | mediumint(8) unsigned | YES | | 7500 | |
| http_get_port | mediumint(8) unsigned | YES | | NULL | |
| hostname | varchar(40) | YES | UNI | NULL | |
| hostip | varchar(15) | YES | UNI | NULL | |
| altip | varchar(15) | YES | UNI | NULL | |
| altmask | varchar(18) | YES | | NULL | |
+---------------+-----------------------------+------+-----+---------+-------+
device(设备块):用于记录各Host中的设备块信息,如总共多大,使用了多少空间,当前设备状态等
+----------+------------------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------------------------------------+------+-----+---------+-------+
| devid | mediumint(8) unsigned | NO | PRI | NULL | |
| hostid | mediumint(8) unsigned | NO | | NULL | |
| status | enum('alive','dead','down','readonly','drain') | YES | MUL | NULL | |
| weight | mediumint(9) | YES | | 100 | |
| mb_total | mediumint(8) unsigned | YES | | NULL | |
| mb_used | mediumint(8) unsigned | YES | | NULL | |
| mb_asof | int(10) unsigned | YES | | NULL | |
+----------+------------------------------------------------+------+-----+---------+-------+
server_settings(服务器设置):服务器的一些配置信息,主要用于记录MogileFS系统执行fsck的相关记录,fsck操作会根据当前mogileFS的备份策略进行文件的备份检查
+--------------------------+----------+
| field | value |
+--------------------------+----------+
| fsck_fids_checked | 0 |
| fsck_fid_at_end | 23972852 |
| fsck_highest_fid_checked | 0 |
| fsck_logid_processed | 6244097 |
| fsck_start_fid | 1121081 |
| fsck_start_maxlogid | 6244097 |
| internal_queue_limit | 500 |
| queue_rate_for_fsck | 2000 |
| queue_size_for_fsck | 20000 |
| schema_version | 12 |
+--------------------------+----------+
fsck_log(fsck日志记录):mogileFS执行fsck时的具体操作记录(具体对某个fid文件进行的操作)
+--------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------------+------+-----+---------+----------------+
| logid | int(10) unsigned | NO | PRI | NULL | auto_increment |
| utime | int(10) unsigned | NO | MUL | NULL | |
| fid | int(10) unsigned | YES | | NULL | |
| evcode | char(4) | YES | | NULL | |
| devid | mediumint(8) unsigned | YES | | NULL | |
+--------+-----------------------+------+-----+---------+----------------+
unreachable_fids(不可达的fid):不可到达的文件列表
+------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| lastupdate | int(10) unsigned | NO | MUL | NULL | |
+------------+------------------+------+-----+---------+-------+
tempfile(不可达的fid):复制的临时文件信息
+------------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------------------+------+-----+---------+----------------+
| fid | int(10) unsigned | NO | PRI | NULL | auto_increment |
| createtime | int(10) unsigned | NO | | NULL | |
| classid | tinyint(3) unsigned | NO | | NULL | |
| dmid | smallint(5) unsigned | NO | | NULL | |
| dkey | varchar(255) | YES | | NULL | |
| devids | varchar(60) | YES | | NULL | |
+------------+----------------------+------+-----+---------+----------------+
file(文件基本信息):记录文件的基本信息,属于哪个域,哪个类,fid对应的dkey、文件大小以及记录该文件的复制份数是多少
+----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| dmid | smallint(5) unsigned | NO | MUL | NULL | |
| dkey | varchar(255) | YES | | NULL | |
| length | bigint(20) unsigned | YES | | NULL | |
| classid | tinyint(3) unsigned | NO | | NULL | |
| devcount | tinyint(3) unsigned | NO | | NULL | |
+----------+----------------------+------+-----+---------+-------+
file_on(文件所在设备):记录每个fid文件在什么设备上,一个fid文件同时存储在多个设备上,则各有一条记录
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| devid | mediumint(8) unsigned | NO | PRI | NULL | |
+-------+-----------------------+------+-----+---------+-------+
file_on_corrupt(损坏的文件):记录哪一个文件在哪个设备上损坏了
+-------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| devid | mediumint(8) unsigned | NO | PRI | NULL | |
+-------+-----------------------+------+-----+---------+-------+
file_to_delete(要删除的文件):记录哪些文件需要删除
+-------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
+-------+------------------+------+-----+---------+-------+
file_to_delete2(要删除的文件):记录删除失败的文件以及再次尝试的时间和失败的总次数
+-----------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| nexttry | int(10) unsigned | NO | MUL | NULL | |
| failcount | tinyint(3) unsigned | NO | | 0 | |
+-----------+---------------------+------+-----+---------+-------+
file_to_delete_later(要延迟删除的文件):记录要延迟删除的文件
+----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| delafter | int(10) unsigned | NO | MUL | NULL | |
+----------+------------------+------+-----+---------+-------+
file_to_queue(当前排队的文件):不详
+-----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| devid | int(10) unsigned | YES | | NULL | |
| type | tinyint(3) unsigned | NO | PRI | NULL | |
| nexttry | int(10) unsigned | NO | | NULL | |
| failcount | tinyint(3) unsigned | NO | | 0 | |
| flags | smallint(5) unsigned | NO | | 0 | |
+-----------+----------------------+------+-----+---------+-------+
file_to_replicate(要做复制分发的文件):要做分发的文件,记录来源设备,失败次数和下次重试的时间等信息。
+-----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------------------+------+-----+---------+-------+
| fid | int(10) unsigned | NO | PRI | NULL | |
| nexttry | int(10) unsigned | NO | MUL | NULL | |
| fromdevid | int(10) unsigned | YES | | NULL | |
| failcount | tinyint(3) unsigned | NO | | 0 | |
| flags | smallint(5) unsigned | NO | | 0 | |
+-----------+----------------------+------+-----+---------+-------+