fastdfs 简介
FastDFS是一个国产开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。FastDFS服务端有两个角色:跟踪器(tracker)和存储节点(storage)。跟踪器主要做调度工作,在访问上起负载均衡的作用。
官方论坛: http://www.csource.org
下载地址: http://sourceforge.net/projects/fastdfs/files/
github软件仓库
libfastcommon-FastDFS和FastDHT的通用函数库,地址:https://github.com/happyfish100/libfastcommon.git
FastDFS — FastDFS主代码,地址: https://github.com/happyfish100/fastdfs.git
fastdfs-nginx-module — FastDFS的nginx模块,地址:https://github.com/happyfish100/fastdfs-nginx-module.git

fastdfs 集群配置

安装文件:

FastDFS 5.x 取消了对 libevent 的依赖,添加了对 libfastcommon 的依赖。
本部署说明用到的软件版本:

libfastcommon v1.13

FastDFS v5.08

fastdfs-nginx-module v1.17

fastdfs安装配置:

创建用户与组

# groupadd fdfs

# useradd fdfs -g fdfs

解压、安装

在每一台trackerstorage服务器上执行

# tar xzvf FastDFS_v5.08.tar.gz

#cd FastDFS/

#./make.sh

#./make.sh install

# yum install -y gcc perl   # 安装依赖的软件包

#cd ~/fdfs/libfastcommon && ./make.sh && ./make.sh install

# cd ~/fdfs/fastdfs && ./make.sh && ./make.sh install

安装完成后,所有可执行文件在目录/usr/bin下,以fdfs_开头:

# ls /usr/bin/fdfs*

fdfs_monitor   fdfs_trackerd  fdfs_storaged

配置文件在目录/etc/fdfs 

client.conf.sample  storage.conf.sample  tracker.conf.sample

FastDFS配置

配置Tracker跟踪器

开放tracker监听端口访问

firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --reload

vim /etc/sysconfig/iptables

service iptables restart

修改配置文件

mkdir -p /data/fastdfs
cd /etc/fdfs
cp tracker.conf.sample tracker.conf
cp /root/fdfs/fastdfs/conf/http.conf .
cp /root/fdfs/fastdfs/conf/mime.types .
sed -i 's:base_path=.*:base_path=/data/fastdfs:g' tracker.conf
sed -i 's:http.server_port=.*:http.server_port=80:g' tracker.con

 1 connect_timeout=30
 2 network_timeout=60
 3 base_path=/data/fastdfs
 4 tracker_server=10.143.92.61:22122
 5 tracker_server=10.143.92.62:22122
 6 log_level=info
 7 use_connection_pool = false
 8 connection_pool_max_idle_time = 3600
 9 load_fdfs_parameters_from_tracker=false
10 use_storage_id = false
11 storage_ids_filename = storage_ids.conf
12 http.tracker_server_port=8080
http.conf

相关文章: