1.安装gcc
yum -y install gcc
2.安装libevent
yum -y install libevent
3.安装libfastcommon-master
unzip libfastcommon-master.zip
cd libfastcommon-master
编译并且安装:
./make.sh
./make.sh install
4.安装fastdfs
tar -zxvf FastDFS_v5.08.tar.gz
cd FastDFS
./make.sh
./make.sh install
5.配置
查看脚本文件
ll /etc/init.d/ | grep fdfs
-
fdfs_trackerd
是tracker启动脚本 -
fdfs_storaged
是storage启动脚本
查看配置模板
ll /etc/fdfs/
-
tarcker.conf.sample
是tracker的配置文件模板 -
storage.conf.sample
是storage的配置文件模板 -
client.conf.sample
是客户端的配置文件模板
5.1.配置并启动tracker服务
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
vim /etc/fdfs/tracker.conf
base_path=/yourpath/tracker
新建目录,根据上述路径
mkdir -p /yourpath/tracker
关闭防火墙
chkconfig iptables off
启动FastDFS Tracker Server服务
service fdfs_trackerd start
chkconfig fdfs_trackerd on
5.2.配置并启动storage服务
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
vim /etc/fdfs/storage.conf
base_path=/yourpath/storage # 数据和日志文件存储根目录
store_path0=/yourpath/storage # 第一个存储目录
tracker_server=xxx.xxx.xxx.xxx:22122 # tracker服务器IP和端口
创建目录,根据上述路径
mkdir -p /yourpath/storage
启动服务
service fdfs_storaged start
chkconfig fdfs_storaged on