一、服务器部署规划

服务器IP 部署服务
192.168.*. tracker、storage、nginx

二、数据存储目录

应用 目录
fastdfs /usr/bin
nginx /usr/local/nginx
tracker_data /data/fastdfs/tracker
storage_data /data/fastdfs/storage
安装包 /home/fastdfs/resources

三、安装部署

1.基本环境依赖安装

yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent  libevent-devel perl unzip wget net-tools

2.libfastcommon 环境部署

[root@ks1 ~]# mkdir -p /home/fastdfs/resources
[root@ks1 ~]# cd /home/fastdfs/resources
[root@ks1 resources]# wget https://github.com/happyfish100/libfastcommon/archive/master.zip
[root@ks1 resources]# unzip master.zip
[root@ks1 resources]# cd libfastcommon-master
[root@ks1 libfastcommon-master]# ./make.sh
[root@ks1 libfastcommon-master]# ./make.sh install

3.fastdfs v5.12安装

[root@ks1 libfastcommon-master]# cd ..
[root@ks1 resources]# rm -rf master.zip
[root@ks1 resources]# wget https://github.com/happyfish100/fastdfs/archive/FastDFS_v5.12.zip
[root@ks1 resources]# unzip FastDFS_v5.12.zip
[root@ks1 resources]# mv FastDFS_v5.12 fastdfs-master
[root@ks1 resources]# cd fastdfs-master
[root@ks1 fastdfs-master]# chmod +x make.sh
[root@ks1 fastdfs-master]# ./make.sh
[root@ks1 fastdfs-master]# ./make.sh install
[root@ks1 fastdfs-master]# cp -ar conf/* /etc/fdfs/
[root@ks1 fastdfs-master]# rm -f /home/fastdfs/resources/FastDFS_v5.12.zip

4.tracker server 配置、启动

[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/tracker/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/tracker.conf`
[root@ks1 fastdfs-master]# sed -i "s/use_connection_pool = false/use_connection_pool = true/g" `grep use_connection_pool -rl /etc/fdfs/tracker.conf`
[root@ks1 fastdfs-master]# mkdir -p /data/fastdfs/tracker
[root@ks1 fastdfs-master]# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
  • [注意]
ARM服务器上搭建Fastdfs和X86一样的安装包和安装步骤,唯一注意的是修改这两个参数,如果不修改trackerd和storage会一直起不来。

1.tracker配置文件tracker.conf

thread_stack_size = 128KB
2.storage配置文件storage.conf thread_stack_size=1024KB
检查tracker server 是否启动成功
[root@ks1 resources]# ps -ef | grep fdfs_trackerd
root 1117 1 0 08:54 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
root 2417 1389 0 09:33 pts/0 00:00:00 grep --color=auto fdfs_trackerd

5.storage server 配置、启动

[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/storage/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/storage.conf`
[root@ks1 fastdfs-master]# vim /etc/fdfs/storage.conf
里面自带的一个tracker_server 把注释
tracker_server=192.168.**.**:22122

[root@ks1 fastdfs-master]# mkdir -p /data/fastdfs/storage
[root@ks1 fastdfs-master]# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
## 注意 storage.conf 文件一定要放到 /etc/fdfs/下 不然异常 异常如下
[root@localhost conf]# /usr/bin/fdfs_storaged ./storage.conf start
[root@localhost conf]# [2022-04-01 10:33:30] ERROR - file: shared_func.c, line: 968, file /./storage.conf not exist
[2022-04-01 10:33:30] ERROR - file: storage_func.c, line: 1087, load conf file "./storage.conf" fail, ret code: 2
[2022-04-01 10:33:30] CRIT - exit abnormally!
检查storage server是否开启成功
[root@ks1 resources]# ps -ef | grep fdfs_storage
root 1120 1 0 08:54 ? 00:00:01 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
root 2510 1389 0 09:39 pts/0 00:00:00 grep --color=auto fdfs_storage
[root@ks1 resources]#

四、文件上传测试

1.修改tracker server 服务器客户端配置文件

[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/client/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/client.conf`
[root@ks1 fastdfs-master]# vim /etc/fdfs/client.conf
tracker_server=192.168.**.**:22122
mkdir -p /data/fastdfs/client

2.执行文件上传命令

[root@ks1 fastdfs-master]# cd /tmp
[root@ks1 tmp]# echo "123" > test.txt
[root@ks1 tmp]# fdfs_test /etc/fdfs/client.conf upload test.txt
This is FastDFS client test program v5.12

Copyright (C) 2008, Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail. [2021-06-10 09:43:51] DEBUG - base_path=/data/fastdfs/client, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
.......

五、安装fastdfs-nginx-module

[root@ks1 tmp]# cd /usr/local/src
[root@ks1 src]# wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# rm -f fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# cd fastdfs-nginx-module/src
[root@ks1 src]# vim config
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib64 -lfastcommon -lfdfsclient"
[root@ks1 src]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/storage/g" `grep home/yuqing/fastdfs -rl mod_fastdfs.conf`
[root@ks1 src]# sed -i "s/tmp/data\/fastdfs\/storage/g" `grep tmp -rl mod_fastdfs.conf`
[root@ks1 src]# sed -i "s/false/true/g" `grep url_have_group_name -rl mod_fastdfs.conf`
[root@ks1 src]# vim mod_fastdfs.conf
tracker_server=192.168.**.**:22122

[group1]
group_name=group1
storage_server_port=23000
store_path_count=2
store_path0=/data/fastdfs/storage
[root@ks1 src]# cp mod_fastdfs.conf /etc/fdfs
[root@ks1 src]# ln -s /data/fastdfs/storage/data/ /data/fastdfs/storage/data/M00
切记 我们把mod_fastdfs.conf 复制到/ect/fdfa下,一定要修改/etc/fdfs/mod_fastdfs.conf下面的地址(修改成自己的地址)
vim /etc/fdfs/
tracker_server=192.168.**.**:22122

六、nginx安装、配置

1.解压ngx_cache_purge-2.3模块

[root@ks1 src]# cd /usr/local/src
[root@ks1 src]# wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
[root@ks1 src]# tar -zxvf ngx_cache_purge-2.3.tar.gz
[root@ks1 src]# rm -f ngx_cache_purge-2.3.tar.gz

2.nginx编译安装

[root@ks1 src]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[root@ks1 src]# tar -zxvf nginx-1.8.0.tar.gz
[root@ks1 src]# rm -f nginx-1.8.0.tar.gz
[root@ks1 src]# cd nginx-1.8.0
[root@ks1 nginx-1.8.0]# useradd -s /sbin/nologin nginx
[root@ks1 nginx-1.8.0]# ./configure --user=nginx --group=nginx --add-module=/usr/local/src/ngx_cache_purge-2.3 --add-module=/usr/local/src/fastdfs-nginx-module/src --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
[root@ks1 nginx-1.8.0]# make
[root@ks1 nginx-1.8.0]# make install
[root@ks1 nginx-1.8.0]# cd /usr/local/nginx/conf
[root@ks1 conf]# mkdir -p /var/cache/nginx/proxy_cache

3.配置文件修改()

[root@ks1 conf]# vim nginx.conf
worker_processes  1;

error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {
worker_connections 1024;
use epoll;
} http {
server_tokens off;
include mime.types;
default_type application/octet-stream; sendfile on;
tcp_nopush on; keepalive_timeout 65; server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 300m;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2
keys_zone=http-cache:500m max_size=10g inactive=30d use_temp_path=off;
proxy_temp_path /var/cache/nginx/proxy_cache/tmp; upstream storage_server_group1{
server 192.168.**.**:8080; } server {
listen 80;
server_name 192.168.**.**; location /group1{
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream http_502 http_504 error timeout invalid_header;
# proxy_cache http-cache;
# proxy_cache_valid 200 304 12h;
# proxy_cache_key $uri$is_args$args;
proxy_pass http://storage_server_group1;
expires 30d;
} location ~/purge(/.*) {
allow 192.168.**.**;
#allow 192.168.**.**;
#allow 192.168.**.**;
deny all;
# proxy_cache_purge http-cache $1$is_args$args;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
} server {
listen 8080;
server_name localhost 192.168.**.**; location / {
root html;
index index.html index.html;
} location /group1/M00/{
root /storage/fdfs/storage-data;
ngx_fastdfs_module
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

4.nginx启动

[root@ks1 conf]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@ks1 conf]# netstat -npl | grep -E "nginx|fdfs"
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1147/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1147/nginx: master
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 1120/fdfs_storaged
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 1117/fdfs_trackerd

5.fs自启动

[root@ks1 conf]# vim /etc/rc.d/rc.local
# fastdfs
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart # nginx
/usr/local/nginx/sbin/nginx
[root@ks1 conf]# chmod +x /etc/rc.d/rc.local

6.浏览器验证

http://192.168.**.**/group1/M00/00/00/wKgFgWDBeECAOzbKAAAABFqCAvc968_big.txt

FastDFS安装(ARM同样支持)的更多相关文章

  1. FastDFS 安装及使用

    FastDFS 安装及使用 2012-11-17 13:10:31|  分类: Linux|举报|字号 订阅     Google了一下,流行的开源分布式文件系统有很多,介绍如下:   mogileF ...

  2. FastDFS安装配置手册

    文件服务器分布式系统安装手册 本文档详细的介绍了FastDFS的最小集群安装过程.集群环境如下: tracker:20.2.64.133 .用于调度工作,在访问上起负载均衡的作用. group1: s ...

  3. Ubuntu安装ARM架构GCC工具链(ubuntu install ARM toolchain)最简单办法

    一.安装ARM-Linux-GCC工具链 只需要一句命令: sudo apt-get install gcc-arm-linux-gnueabi 前提是你的Ubuntu系统版本是官网支持的最新的版本, ...

  4. 【转】Ubuntu安装ARM架构GCC工具链(ubuntu install ARM toolchain)最简单办法

    原文网址:http://www.cnblogs.com/muyun/p/3370996.html 一.安装ARM-Linux-GCC工具链 只需要一句命令: sudo apt-get install ...

  5. FastDFS安装、配置、部署(一)-安装和部署 (转)

    FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 Fast ...

  6. fastdfs安装过程

    Fastdfs于centos7的安装步骤(支持横向拓展) 主要目的:根据网上教程搭建时遇到的问题以及描述不明确的地方进行补充和说明 一.首先需要准备以下4个文件 nginx-1.12.0.tar.gz ...

  7. FastDFS学习总结(1)--FastDFS安装和部署

    FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 Fast ...

  8. Genymotion模拟器安装ARM架构编译应用失败解决方案

    我们在安装一些应用到Genymotion模拟器会提示:adb: failed to install xx.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: ...

  9. linux环境下安装sphinx中文支持分词搜索(coreseek+mmseg)

     linux环境下安装sphinx中文支持分词搜索(coreseek+mmseg) 2013-11-10 16:51:14 分类: 系统运维 为什么要写这篇文章? 答:通过常规的三大步(./confi ...

  10. Ubuntu 上安装 Freemind 并支持中文

    Ubuntu 上安装 Freemind 并支持中文 JAVA 运行时 Freemind 是一个使用 Java 编写的思维导图工具,在安装时,需要到 Java 运行时(使用 OpenJRE 或 Orac ...

随机推荐

  1. Demo of canvas, canvas optimization and svg

    It used the canvas to draw the curves in the old project, and the client felt that it was vague, so ...

  2. IDEA通过Spring Initalizr新建SSM (2)

    之前的方式是通过官网初始化demo(URL:https://start.spring.io/)现在记录一下通过IDEA自带的初始化器新建SSM框架 1.打开IDEA,点击新建,出现如下图菜单,点击Sp ...

  3. 火爆全球的“饺子皮”3D手办原来是这样做的!关键时刻少不了远程控制软件!

    2022年卡塔尔世界杯的吉祥物最近在全球火出圈了,并且喜提中国网友给予的爱称"饺子皮"."馄饨皮"(官方名字:拉伊卜,意为"技艺高超的球员" ...

  4. sprinboot多个子模块下 依赖包没有找到 解决方案

    最近因为在使用springboot开发项目,在开发过程中,发现自己的子模块导入通用的模块 在启动中 说找不到这个类 百度下 说我要在pom文件下 pulus 插件 那里 加上这段代码 <conf ...

  5. WPF使用MaterialDesign开源控件库

    在WPF控件效果这一块,很显然比winfrom要好很多,但想要做出真正好看的控件,我个人觉得还是需要用一些已有的东西比较好,比如MaterialDesign,控件种类多,自带很多图标,上手比较容易,还 ...

  6. 项目中pom.xml的某些坐标无法加载

    项目中pom.xml的某些坐标无法加载 maven官方查找对应的坐标文件下载 https://mvnrepository.com/artifact/com.fasterxml.jackson.core ...

  7. 树莓派4B使用花生壳phtunnel内网穿透访问本地Gogs

    已经搭建好Gogs(https://www.cnblogs.com/congyinew/p/16115074.html),接下来就是想外网上传代码到Gogs 一.申请账号 https://open.o ...

  8. 语言-页面-模板-Velocity

    Velocity教程 - 简书 (jianshu.com) Velocity模板引擎详解 - Velocity 教程 | 编程字典 (codingdict.com) Velocity模板(VM)语言介 ...

  9. JavaScript垃圾回收机制的了解

    对于js种的任意长度字符串,对象,数组是没有固定大小的,只有在分配存储时,解释器就会分配内存来存储这些数据.当js的解释器消耗完系统所有可用内存时,就会造成系统崩溃.因此js有着自己的一套垃圾回收机制 ...

  10. 053_Salesforce Lightning与Classic对比

    Classic页面  Lightning页面  特点: 应用程序的切换更加方便 可以快速访问最近项目和备注等 新的记录页面布局 涡轮增压列表视图 仪表板有所变化 圆滑的报告视图 其中最重要的变化也当属 ...