Fastdfs单机 安装

前言:在单个服务器下安装Fastdfs

安装gcc(编译时需要)

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 

修改配置

  1. tracker配置
vim /etc/fdfs/tracker.conf

修改如下:

base_path = /opt/fastdfs/tracker
  1. storage配置
vim /etc/fdfs/storage.conf

修改如下

base_path = /opt/fastdfs/storage
store_path0 = /opt/fastdfs/storage/files
tracker_server = 你的服务器ip:22122
  1. client配置

vim /etc/fdfs/client.conf

修改如下

base_path = /opt/fastdfs/client
tracker_server = 你的服务器ip:22122
  1. 创建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启动

  1. 启动tracker服务器
/etc/init.d/fdfs_trackerd start
  1. 启动storage服务器
/etc/init.d/fdfs_storaged start
  1. 查看进程
ps -ef | grep fdfs

在这里插入图片描述

FastDFS测试

查看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)

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码

)">
< <上一篇
下一篇>>