FastDFS+Nginx+Fastdfs-nginx-module集群搭建(含配置文件参考)

本文档详细介绍了如何搭建FastDFS、Nginx以及Fastdfs-nginx-module集群。首先,从安装FastDFS的依赖、libfastcommon、fastdfs开始,接着安装Nginx,然后配置FastDFS的客户端、Tracker和Storage,以及Nginx的FastDFS模块。在遇到错误时,提供了解决方案。最后,文章涵盖集群配置和测试步骤,包括上传、下载和删除文件,确保所有服务正常运行。
摘要由CSDN通过智能技术生成

雷电.jpg


版本总览

  • libfastcommon-1.0.42
  • fastdfs-5.11
  • fastdfs-nginx-module-1.20
  • nginx-1.16.1

一、FastDFS

1.1 安装所需依赖包

yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel -y

1.2 安装libfastcommon

  • github选择需要安装的release版本
    https://github.com/happyfish100/libfastcommon/releases

  • 下载安装包
    wget https://github.com/happyfish100/libfastcommon/archive/V1.0.42.tar.gz

  • 解压
    tar -zxvf V1.0.42.tar.gz

  • 安装

cd libfastcommon-1.0.42/
./make.sh
./make.sh install
  • 可能报错:
./make.sh:行14: gcc: 未找到命令
./make.sh:行15: ./a.out: 没有那个文件或目录
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o hash.o hash.c  
make: cc:命令未找到
make: *** [hash.o] 错误 127
  • 解决方案:
根据报错信息显示,应该为未安装gcc导致,故先安装gcc
yum -y install gcc automake autoconf libtool make
安装完成后,重新执行编译命令 ./make.sh 即可

1.3 安装fastdfs

  • github选择需要安装的release版本
    https://github.com/happyfish100/fastdfs/releases

  • 下载安装包
    wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz

  • 解压
    tar -zxvf V5.11.tar.gz

  • 编译
    ./make.sh

  • 安装
    ./make.sh install

可能报错:

致命错误 fastcommon/buffered_file_writer.h:没有那个文件或目录

解决方案:

降低版本重新编译(暂时这么做,没有深究)
  • 拷贝配置文件,修改配置
cd /etc/fdfs/
cp client.conf.sample client.conf
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
  • 修改client.conf
# the base path to store log files,日志以及数据存储位置
base_path=/home/work/fastdfs/fastdfs-data
 
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address tracker_server的ip端口
tracker_server=192.168.10.63:22122
  • 修改trackerd.conf
# the base path to store data and log files
base_path=/home/work/fastdfs/fastdfs-data
  • 修改storaged.conf
# the base path to store data and log files
base_path=/home/work/fastdfs/fastdfs-data
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/home/work/fastdfs/fastdfs-data
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.10.63:22122

1.4 命令行

  • 启动
sudo service fdfs_trackerd start
sudo service fdfs_storaged start
  • 重启
<
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值