一、服务器部署规划

服务器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. 手把手XTTS_V4迁移

    最近公司Oracle升级,考虑到停机时间等综合因数,最终选择了xtts数据迁移方案. 为此我整理了一份操作手册,方便以后查阅. 关于xtts的介绍可以参见这篇文章: <XTTS,又一个值得你重视 ...

  2. 一例OSS问题排查

    某品牌OSS存储,使用IP+PORT可以正常访问.使用NG代理后,不论是IP还是域名访问都不支持SDK访问,但是使用S3客户端可以正常访问. 通过抓包对比发现,S3客户端如下 SDK访问抓包如下 判断 ...

  3. 【Python】变量&数据类型&运算符

    一.Python变量&数据类型&运算符 1.print()函数 1.1 输出数字,字符串,含有运算符的表达式 print(123) print('hello world') print ...

  4. 很抱歉,无法安装Office(64位),因为您的计算机上已经安装了这些32位Office程序

    可使用下面的方法获取最新最全的Win10 KEY: 1.请加微信公众号号:jiangivana 或扫一扫下面的二维码. 2.加微信公众号以后回复[key]将获得最新最全的Win10密钥. 64位与32 ...

  5. .NET在单台Windows2008下百万TCP连接测试

    测试客户端: 客户端程序建立TCP连接,发送一条几个字节的数据. 虚拟机8台,PC机8台,服务器1台. 设置MaxUserPort=60000,有一台机没有设置约在1.5万左右.最后因为差一点到100 ...

  6. QDateEdit

    self.dateEdit.setCalendarPopup(True) # 日历增加 # 日历转化位str类型begintime = self.dateEdit.dateTime().toStrin ...

  7. cmd 备份 oracle 数据 dmp文件

    语法 :     exp 用户名/密码@数据库地址/数据库名 file=文件导出地址/文件名.dmp 实例:exp develop/123@localhost/orcl file=e:/2019-02 ...

  8. 微信小程序:微信web开发阶段性学习总结

    小程序运行机制 前台/后台状态 小程序启动后,界面被展示给用户,此时小程序处于前台状态. 当用户点击右上角胶囊按钮关闭小程序,或者按了设备 Home 键离开微信时,小程序并没有完全终止运行,而是进入了 ...

  9. Maven常用参数及其说明

    Maven常用参数及其说明 -h,--help Display help information-am,--also-make 构建指定模块,同时构建指定模块依赖的其他模块;-amd,--also-m ...

  10. js 获取年月日时分秒,星期

    getDate() { var date = new Date() // 获取时间 var year = date.getFullYear() // 获取年 var month = date.getM ...