FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc
yum install -y gcc gcc-c++安装libevent(运行时需求)
若安装了桌面图形界面,就不需要安装;FastDFS依赖libevent库;
yum -y install libevent安装libfastcommon
在/usr/local/fastdfs下
git clone https://gitee.com/ShiZan/libfastcommon.git cd libfastcommon ./make.sh && ./make.sh install安装fastdfs
在/usr/local/fastdfs下
git clone https://gitee.com/ShiZan/fastdfs.git cd fastdfs ./make.sh && ./make.sh install
配置文件准备
ll /etc/fdfs
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf #客户端文件,测试用 cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf修改配置
- tracker配置
vim /etc/fdfs/tracker.conf
修改如下:
base_path = /opt/fastdfs/tracker
- storage配置
vim /etc/fdfs/storage.conf
修改如下
base_path = /opt/fastdfs/storage store_path0 = /opt/fastdfs/storage/files tracker_server = 你的服务器ip:22122
- client配置
vim /etc/fdfs/client.conf
修改如下
base_path = /opt/fastdfs/client tracker_server = 你的服务器ip:22122
- 创建base_path指定的目录
mkdir /opt/fastdfs mkdir /opt/fastdfs/tracker mkdir /opt/fastdfs/storage mkdir /opt/fastdfs/storage/files mkdir /opt/fastdfs/client防火墙开发22122、23000端口
防火墙开发指定端口
FastDFS启动- 启动tracker服务器
/etc/init.d/fdfs_trackerd start
- 启动storage服务器
/etc/init.d/fdfs_storaged start
- 查看进程
ps -ef | grep fdfsFastDFS测试
查看fastDFS命令
ll /usr/bin/fdfs_*
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /usr/local/fastdfs/fastdfs-nginx-module_v1.16.tar.gz
上传完成后会返回相应的路径文件名
group1/M00/00/00/eBgnHWGksjyABEAtAABEZkYgONo.tar.gz
查看所上传的文件
ll /opt/fastdfs/storage/data/00/00
删除上传的文件
/usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/eBgnHWGksjyABEAtAABEZkYgONo.tar.gz
分布式文件系统FastDFS的HTTP访问(配置nginx)



