环境准备
使用的系统软件
名称 | 说明 |
---|---|
centos | 7.x |
libfatscommon | FastDFS分离出的一些公用函数包 |
FastDFS | FastDFS本体 |
fastdfs-nginx-module | FastDFS和nginx的关联模块 |
nginx | nginx1.15.4 |
编译环境
1 | yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y |
磁盘目录
说明 | 位置 |
---|---|
所有安装包 | /usr/local/src |
数据存储位置 | /home/dfs/ |
#这里我为了方便把日志什么的都放到了dfs |
1 | mkdir /home/dfs #创建数据存储目录 |
安装libfatscommon
1 | git clone https://github.com/happyfish100/libfastcommon.git --depth 1 |
安装FastDFS
1 | cd ../ #返回上一级目录 |
安装fastdfs-nginx-module
1 | cd ../ #返回上一级目录 |
安装nginx
1 | wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包 |
单机部署
tracker配置
1 | #服务器ip为 192.168.52.1 |
storage配置
1 | vim /etc/fdfs/storage.conf |
client测试
1 | vim /etc/fdfs/client.conf |
配置nginx访问
1 | vim /etc/fdfs/mod_fastdfs.conf |
分布式部署
tracker配置
1 | #服务器ip为 192.168.52.2,192.168.52.3,192.168.52.4 |
storage配置
1 | vim /etc/fdfs/storage.conf |
client测试
1 | vim /etc/fdfs/client.conf |
配置nginx访问
1 | vim /etc/fdfs/mod_fastdfs.conf |
启动
防火墙
1 | #不关闭防火墙的话无法使用 |
tracker
1 | init.d/fdfs_trackerd start |
storage
1 | init.d/fdfs_storaged start |
nginx
1 | local sbin/nginx |
检测集群
1 | /usr/bin/fdfs_monitor /etc/fdfs/storage.conf |
说明
配置文件
1 | tracker_server #有几台服务器写几个 |
可能遇到的问题
1 | 如果不是root 用户 你必须在除了cd的命令之外 全部加sudo |
官方部署文档地址:FastDFS