一、服务器部署规划

服务器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. 空间数据格式(地理数据格式):GeoJSON(FeatureCollection)与EsriJSON(FeatureSet/ArcGIS格式)

    一.FeatureCollection(GeoJSON)格式介绍 https://learn.microsoft.com/en-us/javascript/api/azure-maps-control ...

  2. JDBC之ResultSet和元数据

    ResultSet 从名字上就可以看到是结果集,表示的是查询出来的结果集. JDBC用ResultSet来封装结果集,查询结果表的对象. 查询结果分为两种情况: 单值 单个结果,比如说SQL如下: s ...

  3. Kubernetes之Pod详解

    1.Pod生命周期 pod创建 1. API Server 在接收到创建pod的请求之后,会根据用户提交的参数值来创建一个运行时的pod对象. 2. 根据 API Server 请求的上下文的元数据来 ...

  4. java问题解答

    因为子类继承自父类,会沿用父类的东西(没被覆盖的函数以及可见的成员变量等),而这些东西子类是没有的,需要先初始化父类才能被使用 子类构造方法中调用父类构造方法,一个作用是可以给父类构造方法传递实参,给 ...

  5. Something Just Like This

    I've been reading books of old我遍读旧籍 The legends and the myths那些古老传奇和无边神秘 Achilles and his gold如阿喀琉斯和 ...

  6. navicat 远程连接不上mysql

    1 查看是否开启远程连接(拿root用户举例) use mysql; select host, user from user; 以上便是开启远程连接,如果依旧不能连接,参考如下: grant all ...

  7. 工作三年的.NET程序员现状及其感悟

    算上实习,已经工作三年了.时间过的真的很快,我也从一开始的非标自动化行业成功转入了医疗器械行业,如今在苏州园区的BioBay工作,这里我每天都工作的挺开心的.也于11.6号第一次和如今的女朋友见面,并 ...

  8. 合并B站video.m4s和audio.m4s

    ffmpeg -i D:\a\video.m4s -i D:\a\audio.m4s -codec copy D:\a\a.mp4

  9. Coursera Programming Languages, Part B 华盛顿大学 Week 1

    来上 programming language 的第二 part 了!这一部分介绍的语言是 Racket,之前就听说过它独特的括号语法,这次来具体了解一下 Racket definitions, fu ...

  10. BASE64编码作业

    BASE64编码作业 什么是BASE64编码 ase64是网络上最常见的用于传输8Bit字节码的编码方式之一,Base64就是一种基于64个可打印字符来表示二进制数据的方法.可查看RFC2045-RF ...