"Write Your Own Cloud Disk" - Database Design

Personal homepage link: http://www.tongtongxue.com/archives/4812.html   

Overview

    " Write Your Own Cloud Disk " will involve two kinds of databases, one is a relational database, namely MySQL, and the other is NoSQL database HBase . Currently , only file information is stored in HBase, and other information is stored in MySQL . The database design is as follows:

 

The tables stored in MySQL are as follows:
User login information table: yp_auth

field name

Types of

illustrate

login_id

varchar(32)

primary key

login_name

varchar(128)

log-in name

password

varchar(32)

password, encrypted

create_datetime

datetime

creation time

create_ip

varchar(32)

IP at creation

latest_login_datetime

datetime

Last login time

latest_login_ip

varchar(32)

IP at last login

is_active

int

status, 0 : inactive;

1 : normal; 2 : disabled

person_id

varchar(32)

foreign key,

Refers to the primary key of the yp_person table

Personal Information Form: yp_person

field name

Types of

illustrate

person_id

varchar(32)

primary key

real_name

varchar(128)

actual name

email

varchar(128)

E-mail

telephone

varchar(128)

fixed number

cellphone

varchar(128)

cellphone number

introduction

varchar(4000)

Personal profile

picture

varchar(128)

Personal avatar, storage path

create_datetime

datetime

creation time

Upload file table: yp_upload_file

field name

Types of

illustrate

upload_file_id

varhcar(32)

primary key

original_name

varchar(256)

文件原始名称

file_size

long

文件大小

file_type

varchar(128)

文件类型

path

vachar(128)

文件路径,

存放HBase中某条记录的rowkey

person_id

varchar(32)

外键,

引用yp_person表的主键

create_datetime

datetime

创建时间

order_id

int

排序字段

upload_ip

varchar(32)

上传文件时的IP

directory_id

varchar(32)

外键,

引用yp_directory表的主键,

表示该文件所在的目录

status_id

int

文件状态

reserve1

varchar(1024)

备用字段1

reserve2

varchar(1024)

备用字段2

reserve3

varchar(1024)

备用字段3

reserve4

varchar(1024)

备用字段4

reserve5

varchar(1024)

备用字段5

文件目录表:yp_directory

字段名

类型

说明

directory_id

varchar(32)

主键

directory_name

varchar(128)

目录名

parent_id

varchar(32)

父目录的ID

person_id

varchar(32)

外键,

引用yp_person表的主键

create_datetime

datetime

创建时间

文件分享表:yp_share_file

字段名

类型

说明

share_file_id

varchar(32)

主键

upload_file_id

varchar(32)

外键,

引用yp_upload_file的主键

person_id

varchar(32)

外键,

引用yp_person的主键

share_code

varchar(32)

分享的唯一编码

status

int

分享状态

share_type

int

分享类型,0:私密分享;

1:公开分享

create_datetime

datetime

创建时间

HBase中存放的表如下:

文件信息表:yp_file

字段名

说明

rowkey

rowkey

file_info.file

file_info为列簇,存放文件

file_info.person_id

file_info为列簇,存放个人信息表的主键

   关注微信公众号


 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326569258&siteId=291194637