未命名文档


FastDFS的安装

FastDFS安装2009-07-23 15:36转载: http://blog.chinaunix.net/u/12479/showart_1341477.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/files/FastDFS_v1.21.tar.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/distfiles/libevent-1.4.9-stable.tar.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

添加新评论 »