目录

常用命令:

fdfs_trackerd /etc/fdfs/tracker.conf  start   启动fdfs_storaged /etc/fdfs/storage.conf  start   启动

一、环境准备

二、安装 libfastcommon

上传到 /usr/local/fastdfs 解压

三、安装FastDFS

四、 启动 配置跟踪端tracker 

五、配置启动存储服务 Storage

六、配置客户端Client

上传测试  

​编辑

七、配置解释器fastdfs-nginx-module

修改配置文件,修改内容如图。vim /usr/local/fastdfs/fastdfs-nginx-module-1.22/src/config

八、安装Nginx

常用命令:

fdfs_trackerd /etc/fdfs/tracker.conf  start   启动 fdfs_storaged /etc/fdfs/storage.conf  start   启动

一、环境准备

环境:麒麟 4.19.90-24.4.v2101.ky10.x86_64

 软件包  

 1.  https://github.com/happyfish100/fastdfs/tagsfastDFS  1.  https://github.com/happyfish100/fastdfs/tags  

2.  Tags · happyfish100/libfastcommon · GitHubfastDFS-common 2.  Tags · happyfish100/libfastcommon · GitHub           

3. Tags · happyfish100/fastdfs-nginx-module · GitHubfastDFS-common 3. Tags · happyfish100/fastdfs-nginx-module · GitHub 

4.nginx nginx: download 

下载地址

https://github.com/happyfish100/libfastcommon/tags

https://github.com/happyfish100/fastdfs/tags

https://github.com/happyfish100/fastdfs-nginx-module/tags x

http://nginx.org/en/download.html

 安装的目录规划都安装在/usr/local/fastdfs  目录下,压缩包都解压到这个目录下

base_path=/usr/local/fastdfs/fastDFS_data  用来调度的

store_path0=/usr/local/fastdfs/storage   用来真实存储的文件

所有软件上传到/usr/local/fastdfs

二、安装 libfastcommon

#安装GCC-c++ 安装libevent库

yum -y install gcc-c++ libevent

上传到 /usr/local/fastdfs 解压

tar -zxvf libfastcommon-1.0.66.tar.gz

进入解压的文件夹

cd /usr/local/fastdfs/libfastcommon-1.0.66/

安装并编译

./make.sh

./make.sh install

三、安装FastDFS

解压并安装

tar -zxvf fastdfs-6.08.tar.gz

cd /usr/local/fastdfs/fastdfs-6.08/

复制配置文件并编译

cp -r /usr/local/fastdfs/fastdfs-6.08/conf/* /etc/fdfs/

./make.sh

./make.sh install

 修改配置文件

首先需要准备一个目录用于存储跟踪节点trackerd的文件。

mkdir -p /usr/local/fastdfs/tracker/

然后修改tracker的配置文件,修改内容如图。

vim /etc/fdfs/tracker.conf

将base_path改为

base_path= /usr/local/fastdfs/tracker

四、 启动 配置跟踪端tracker 

# 启动start 重启restart 关闭stop。

fdfs_trackerd /etc/fdfs/tracker.conf start

# 查看是否启动

netstat -tnlp | grep 22122

五、配置启动存储服务 Storage

和tracker一样先创建一个存储的文件夹,这个是存储端。

mkdir -p /usr/local/fastdfs/storage/

配置,

vim /etc/fdfs/storage.conf

修改3个地方

base_path=/usr/local/fastdfs/fastDFS_data

store_path0=/usr/local/fastdfs/storage

tracker_server= 192.168.11.132:22122

 启动 存储服务

fdfs_storaged /etc/fdfs/storage.conf start

查看/usr/local/fastdfs/storage 目录下data文件,如下图就说明你成功了。没出来可以查看storage下log日志查看错误原因

 注意:没起来的看日志 /usr/local/fastdfs/fastDFS_data/logs/storaged.log

六、配置客户端Client

mkdir -p /usr/local/fastdfs/client/

vim /etc/fdfs/client.conf

修改

base_path=/usr/local/fastdfs/client

tracker_server=192.168.11.132:22122

上传测试  

fdfs_test /etc/fdfs/client.conf upload /home/1.jpg

上传完,现在是不能访问的,还需要安装上nginx才能实现。

七、配置解释器fastdfs-nginx-module

解压

tar -zxvf fastdfs-nginx-module-1.22.tar.gz

修改配置文件,修改内容如图。 vim /usr/local/fastdfs/fastdfs-nginx-module-1.22/src/config

修改/usr/local/include  去掉 local 改为/usr/include

首先现将文件拷贝到总的配置文件夹下 

cp /usr/local/fastdfs/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/

vim /etc/fdfs/mod_fastdfs.conf

只要看4个地方

base_path= /usr/local/fastdfs/tracker

tracker_server=192.168.11.132:22122

url_have_group_name = true

store_path0=/usr/local/fastdfs/storage

八、安装Nginx

安装nginx 

yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel

./configure --prefix=/usr/local/nginx --add-module=/usr/local/fastdfs/fastdfs-nginx-module-1.22/src

make -j4 && make -j4 install

安装成功

配置nginx

server {

listen 80;

server_name localhost;

location /group1/M00/ {

root /usr/local/fastdfs/storage/data;

ngx_fastdfs_module;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

上传文件测试成功 

fdfs_test /etc/fdfs/client.conf upload  /home/1.jpg

访问

 大功告成!!呵呵

参考:https://www.cnblogs.com/musiro/p/16512013.html#/c/subject/p/16512013.html

参考链接

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。