FastDFS

FastDFS_v5.08.tar.gz:FastDFS源码
libfastcommon-master.zip:(从 FastDFS 和 FastDHT 中提取出来的公共 C 函数库)
fastdfs-nginx-module-master.zip:storage节点http服务nginx模块
nginx-1.10.0.tar.gz:Nginx安装包
ngx_cache_purge-2.3.tar.gz:图片缓存清除Nginx模块(集群环境会用到)

一、所有tracker和storage节点都执行如下操作

1、安装所需的依赖包

yum install make cmake gcc gcc-c++

2、安装libfatscommon

cd /usr/local/src

安装unzip 命令:

 yum install -y unzip zip unzip libfastcommon-master.zip

编译、安装

cd libfastcommon-master
./make.sh 
./make.sh install

3、安装FastDFS

cd /usr/local/src tar -xzvf FastDFS_v5.08.tar.gz
cd FastDFS
./make.sh
./make.sh install

采用默认安装方式,相应的文件与目录如下:

1> 服务脚本:

/etc/init.d/fdfs_storaged /etc/init.d/fdfs_trackerd
2> 配置文件(示例配置文件):

ll /etc/fdfs/ 

 -rw-r--r-- 1 root root 1461 1月 4 14:34 client.conf.sample 
 -rw-r--r-- 1 root root 7927 1月 4 14:34 storage.conf.sample 
 -rw-r--r-- 1 root root 7200 1月 4 14:34 tracker.conf.sample

3> 命令行工具(/usr/bin目录下)

-rwxr-xr-x 1 root root 260584 14 14:34 fdfs_appender_test 
-rwxr-xr-x 1 root root 260281 14 14:34 fdfs_appender_test1 
-rwxr-xr-x 1 root root 250625 14 14:34 fdfs_append_file 
-rwxr-xr-x 1 root root 250045 14 14:34 fdfs_crc32 
-rwxr-xr-x 1 root root 250708 14 14:34 fdfs_delete_file 
-rwxr-xr-x 1 root root 251515 14 14:34 fdfs_download_file 
-rwxr-xr-x 1 root root 251273 14 14:34 fdfs_file_info 
-rwxr-xr-x 1 root root 266401 14 14:34 fdfs_monitor 
-rwxr-xr-x 1 root root 873233 14 14:34 fdfs_storaged 
-rwxr-xr-x 1 root root 266952 14 14:34 fdfs_test 
-rwxr-xr-x 1 root root 266153 14 14:34 fdfs_test1 
-rwxr-xr-x 1 root root 371336 14 14:34 fdfs_trackerd 
-rwxr-xr-x 1 root root 251651 14 14:34 fdfs_upload_appender 
-rwxr-xr-x 1 root root 252781 14 14:34 fdfs_upload_file

二、配置tracker服务器

1> 复制tracker样例配置文件,并重命名

cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

2> 修改tracker配置文件

vim /etc/fdfs/tracker.conf

修改的内容如下:

  • disabled=false # 启用配置文件
  • port=22122 # tracker服务器端口(默认22122)
  • base_path=/fastdfs/tracker # 存储日志和数据的根目录
    其它参数保留默认配置, 具体配置解释可参考官方文档说明:http://bbs.chinaunix.net/thread-1941456-1-1.html

3> 创建base_path指定的目录

mkdir -p /fastdfs/tracker

4> 防火墙中打开tracker服务器端口( 默认为 22122)

/etc/init.d/fdfs_trackerd start

初次启动,会在/fastdfs/tracker目录下生成logs、data两个目录。

drwxr-xr-x 2 root root 4096 14 15:00 data 
drwxr-xr-x 2 root root 4096 14 14:38 logs

检查FastDFS Tracker Server是否启动成功:

ps -ef | grep fdfs_trackerd

三、配置storage服务器

1> 复制storage样例配置文件,并重命名

cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

2> 编辑配置文件

vi /etc/fdfs/storage.conf

修改的内容如下:

  • disabled=false # 启用配置文件
  • port=23000 # storage服务端口
  • base_path=/fastdfs/storage # 数据和日志文件存储根目录
  • store_path0=/fastdfs/storage # 第一个存储目录
  • tracker_server=ip01:22122 # tracker服务器IP和端口
  • http.server_port=8888# http访问文件的端口 现可不配
    其它参数保留默认配置, 具体配置解释可参考官方文档说明http://bbs.chinaunix.net/thread-1941456-1-1.html

3> 创建基础数据目录

mkdir -p /fastdfs/storage

4> 防火墙中打开storage服务器端口( 默认为 23000)

vi /etc/sysconfig/iptables

添加如下端口行:

-A INPUT -m state –state NEW -m tcp -p tcp –dport 23000 -j ACCEPT
重启防火墙

service iptables restart

重点:启动

/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
/usr/local/bin/fdfs_storage /etc/fdfs/storage.conf restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值