FastDFS是一个轻量级的开源分布式文件系统
FastDFS主要解决了大容量的文件存储和高并发访问的问题,文件存取时实现了负载均衡
FastDFS实现了软件方式的RAID,可以使用廉价的IDE硬盘进行存储
支持存储服务器在线扩容
支持相同内容的文件只保存一份,节约磁盘空间
FastDFS只能通过Client API访问,不支持POSIX访问方式
FastDFS特别适合大中型网站使用,用来存储资源文件(如:图片、文档、音频、视频等等)
FastDFS主要解决了大容量的文件存储和高并发访问的问题,文件存取时实现了负载均衡
FastDFS实现了软件方式的RAID,可以使用廉价的IDE硬盘进行存储
支持存储服务器在线扩容
支持相同内容的文件只保存一份,节约磁盘空间
FastDFS只能通过Client API访问,不支持POSIX访问方式
FastDFS特别适合大中型网站使用,用来存储资源文件(如:图片、文档、音频、视频等等)
0
相关术语
Tracker Server:跟踪服务器,主要做调度工作,在访问上起负载均衡的作用。记录storage server的状态,是连接Client和Storage server的枢纽。
Storage Server:存储服务器,文件和meta data都保存到存储服务器上
group:组,也可称为卷。同组内服务器上的文件是完全相同的
文件标识:包括两部分:组名和文件名(包含路径)
meta data:文件相关属性,键值对(Key Value Pair)方式,如:width=1024,heigth=768
Tracker Server:跟踪服务器,主要做调度工作,在访问上起负载均衡的作用。记录storage server的状态,是连接Client和Storage server的枢纽。
Storage Server:存储服务器,文件和meta data都保存到存储服务器上
group:组,也可称为卷。同组内服务器上的文件是完全相同的
文件标识:包括两部分:组名和文件名(包含路径)
meta data:文件相关属性,键值对(Key Value Pair)方式,如:width=1024,heigth=768
0
同步机制
同一组内的storage server之间是对等的,文件上传、删除等操作可以在任意一台storage server上进行;
文件同步只在同组内的storage server之间进行,采用push方式,即源服务器同步给目标服务器;
源头数据才需要同步,备份数据不需要再次同步,否则就构成环路了;
上述第二条规则有个例外,就是新增加一台storage server时,由已有的一台storage server将已有的所有数据(包括源头数据和备份数据)同步给该新增服务器。
同一组内的storage server之间是对等的,文件上传、删除等操作可以在任意一台storage server上进行;
文件同步只在同组内的storage server之间进行,采用push方式,即源服务器同步给目标服务器;
源头数据才需要同步,备份数据不需要再次同步,否则就构成环路了;
上述第二条规则有个例外,就是新增加一台storage server时,由已有的一台storage server将已有的所有数据(包括源头数据和备份数据)同步给该新增服务器。
0
通信协议
协议包由两部分组成:header和body
header共10字节,格式如下:
8 bytes body length
1 byte command
1 byte status
body数据包格式由取决于具体的命令,body可以为空
协议包由两部分组成:header和body
header共10字节,格式如下:
8 bytes body length
1 byte command
1 byte status
body数据包格式由取决于具体的命令,body可以为空
0
安装和运行
#step 1. download FastDFS source package and unpack it,
# if you use HTTP to download file, please download libevent 1.4.x and install it
tar xzf FastDFS_v1.x.tar.gz
#for example:
tar xzf FastDFS_v1.20.tar.gz
#step 2. enter the FastDFS dir
cd FastDFS
#step 3. if HTTP supported, modify make.sh, uncomment the line:
# WITH_HTTPD=1, then execute:
./make.sh
#step 4. make install
./make.sh install
#step 5. edit/modify the config file of tracker and storage
#step 6. run server programs
#start the tracker server:
/usr/local/bin/fdfs_trackerd
#start the storage server:
/usr/local/bin/fdfs_storaged
#step 1. download FastDFS source package and unpack it,
# if you use HTTP to download file, please download libevent 1.4.x and install it
tar xzf FastDFS_v1.x.tar.gz
#for example:
tar xzf FastDFS_v1.20.tar.gz
#step 2. enter the FastDFS dir
cd FastDFS
#step 3. if HTTP supported, modify make.sh, uncomment the line:
# WITH_HTTPD=1, then execute:
./make.sh
#step 4. make install
./make.sh install
#step 5. edit/modify the config file of tracker and storage
#step 6. run server programs
#start the tracker server:
/usr/local/bin/fdfs_trackerd
#start the storage server:
/usr/local/bin/fdfs_storaged
0
本帖最后由 andy 于 2009-10-13 17:08 编辑
FastDFS的安装
FastDFS安装2009-07-23 15:36转载: http://blog.chinaunix.net/u/12 ... .html
系统:Gentoo-linux
Tracker Server:10.60.0.110 10.60.0.242
Storage Server:10.60.0.112 10.60.0.233 10.60.0.241
根据源代码中的INSTALL,FastDFS的安装非常简单。
1、安装
#wget http://fastdfs.googlecode.com/ ... ar.gz
#tar zxf FastDFS_v1.11.tar.gz
#cd FastDFS
#./make.sh
#mkdir /usr/local/include
#./make.sh install
要想支持http需要下载libevent-1.4x...
wget http://down1.chinaunix.net/dis ... ar.gz
2、配置文件
2.1 Tracker Server
#cat /etc/conf.d/FastDFS_tracker.conf
###start of tracker server config###
disabled=false
bind_addr=
port=22122
network_timeout=20
base_path=/ms/var/FastDFS
max_connections=256
#0: round robin
#1: specify group
#2: load balance
store_lookup=0
#when store_lookup set to 1(specify group), must set store_group to the group name
store_group=group1
#reserved storage space for system or other applications.
#if the free(available) space of any stoarge server in a group <= reserved_storage_space,
#no file can be uploaded to this group.
#bytes unit can be one of follows:
### G or g for gigabyte(GB)
### M or m for megabyte(MB)
### K or k for kilobyte(KB)
### no unit for byte(B)
reserved_storage_space = 4GB
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
###end of tracker server config###
2.2 Storage Server
相同group的配置文件内容要一样
#cat /etc/conf.d/FastDFS_storage.conf
###start of storage server config###
disabled=false
group_name=group1
bind_addr=
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=600
base_path=/ms/var/FastDFS
sync_wait_msec=200
max_connections=256
tracker_server=10.60.0.110:22122
tracker_server=10.60.0.242:22122
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
###end of storage server config###
3、启动
首先在Tracker Server和Storage Server上建立目录/ms/var/FastDFS
3.1 Tracker Server 启动
在10.60.0.110和10.60.0.242启动Tracker进程:
#/usr/local/bin/fdfs_trackerd /etc/conf.d/FastDFS_tracker.conf
3.2 Storage Server 启动
在10.60.0.112,10.60.0.233和10.60.0.241上启动storage进程:
#/usr/local/bin/fdfs_storaged /etc/conf.d/FastDFS_storage.conf
4、测试
在一台Storage Server上运行
#/usr/local/bin/fdfs_test /etc/conf.d/FastDFS_storage.conf upload needed_upload_filename
FastDFS的安装
FastDFS安装2009-07-23 15:36转载: http://blog.chinaunix.net/u/12 ... .html
系统:Gentoo-linux
Tracker Server:10.60.0.110 10.60.0.242
Storage Server:10.60.0.112 10.60.0.233 10.60.0.241
根据源代码中的INSTALL,FastDFS的安装非常简单。
1、安装
#wget http://fastdfs.googlecode.com/ ... ar.gz
#tar zxf FastDFS_v1.11.tar.gz
#cd FastDFS
#./make.sh
#mkdir /usr/local/include
#./make.sh install
要想支持http需要下载libevent-1.4x...
wget http://down1.chinaunix.net/dis ... ar.gz
2、配置文件
2.1 Tracker Server
#cat /etc/conf.d/FastDFS_tracker.conf
###start of tracker server config###
disabled=false
bind_addr=
port=22122
network_timeout=20
base_path=/ms/var/FastDFS
max_connections=256
#0: round robin
#1: specify group
#2: load balance
store_lookup=0
#when store_lookup set to 1(specify group), must set store_group to the group name
store_group=group1
#reserved storage space for system or other applications.
#if the free(available) space of any stoarge server in a group <= reserved_storage_space,
#no file can be uploaded to this group.
#bytes unit can be one of follows:
### G or g for gigabyte(GB)
### M or m for megabyte(MB)
### K or k for kilobyte(KB)
### no unit for byte(B)
reserved_storage_space = 4GB
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
###end of tracker server config###
2.2 Storage Server
相同group的配置文件内容要一样
#cat /etc/conf.d/FastDFS_storage.conf
###start of storage server config###
disabled=false
group_name=group1
bind_addr=
port=23000
network_timeout=20
heart_beat_interval=30
stat_report_interval=600
base_path=/ms/var/FastDFS
sync_wait_msec=200
max_connections=256
tracker_server=10.60.0.110:22122
tracker_server=10.60.0.242:22122
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
#unix group name to run this program,
#not set (empty) means run by the group of current user
run_by_group=
#unix username to run this program,
#not set (empty) means run by current user
run_by_user=
# allow_hosts can ocur more than once, host can be hostname or ip address,
# "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or
# host[01-08,20-25].domain.com, for example:
# allow_hosts=10.0.1.[1-15,20]
# allow_hosts=host[01-08,20-25].domain.com
allow_hosts=*
###end of storage server config###
3、启动
首先在Tracker Server和Storage Server上建立目录/ms/var/FastDFS
3.1 Tracker Server 启动
在10.60.0.110和10.60.0.242启动Tracker进程:
#/usr/local/bin/fdfs_trackerd /etc/conf.d/FastDFS_tracker.conf
3.2 Storage Server 启动
在10.60.0.112,10.60.0.233和10.60.0.241上启动storage进程:
#/usr/local/bin/fdfs_storaged /etc/conf.d/FastDFS_storage.conf
4、测试
在一台Storage Server上运行
#/usr/local/bin/fdfs_test /etc/conf.d/FastDFS_storage.conf upload needed_upload_filename
编辑回复