FastDFS 介绍及安装部署

分布式文件系统FastDFS 概述 FastDFS是一个开源的轻量级分布式文件系统,是我国一款开源的分布式文件系统 由阿里巴巴开发,其真题架构由跟踪服务器(tracker server)、存储服务器(storage server)和客户端(client)三个部分组成,主要解决了海量数据存储问题,特别适合以中小文件(建议范围:4KB < file_size <500MB)为载体的在线服务。 特点: 1>Fast...... 阅读详情

https://github.com/happyfish100

FastDFS 是一款开源的轻量级分布式文件系统,

  • 纯C实现,支持Linux、FreeBSD等类UNIX系统;
  • 类Google FS,不是通用的文件系统,只能通过专有的API访问,目前提供了 C、Java和PHP API;
  • 为互联网应用量身定做,追求高性能和高扩展型;
  • FastDFS可以看做是基于文件系统的key/value pair存储系统,称作分布式文件存储服务更为合适;
  • 更倾向于存储中小型文件(4KB~500MB);

FastDFS 组成

Tracker Server

跟踪服务器,主要做调度工作,在访问时起负载均衡的作用。在内存中记录 集群中group和storage服务器的状态信息,是连接客户端和Storage服务端的枢纽。因为相关信息全部在内存中,Tracker服务器的性能非常高,一个较大的集群(比如上百个group)中有3台就足够了。

Storage Server

存储服务器,文件和文件属性(meta data)都保存到存储服务器上。

FastDFS上传机制

title FastDFS上传机制
participant Client
participant Tracker_Server
participant Storage_Server

Storage_Server -> Tracker_Server: 1. 定时向Tracker上传状态信息
Client -> Tracker_Server: 2. 上传连接请求
Tracker_Server -> Tracker_Server: 3. 查询可用storage
Client <- Tracker_Server: 4. 返回信息(storage的IP和端口)
Client -> Storage_Server: 5. 上传文件(file content和meta data)
Storage_Server -> Storage_Server: 6. 生成file_id
Storage_Server -> Storage_Server: 7. 将上传内容写入硬盘
Client <- Storage_Server: 8. 返回file_id(路径信息和文件名)
Client -> Client: 9. 存储文件信息

在这里插入图片描述

FastDFS使用场景

FastDFS架构

FastDFS 架构图如下:
在这里插入图片描述

实验环境

主机名 IP地址 说明
tracker01.lavenliu.com 192.168.20.160 追踪服务器01
tracker02.lavenliu.com 192.168.20.161 追踪服务器02
storage01.lavenliu.com 192.168.20.162 存储服务器01
storage02.lavenliu.com 192.168.20.163 存储服务器02
client01.lavenliu.com 192.168.20.164 客户端01

上述表作废,以下面的为准,所有服务安装在一台机器上。

主机名 IP地址 说明
tracker.lavenliu.com 192.168.16.137 追踪服务器
storage.lavenliu.com 192.168.16.137 存储服务器
client.lavenliu.com 192.168.16.137 客户端
xxx 10.20.20.35 迁移用服务器

实验环境中用到的版本信息:

  • Nginx 1.21.1
  • FastDFS 6.0.7
  • FastDFS libfastcommon 1.0.48
  • Nginx FastDFS Module 1.22

部署 FastDFS

安装依赖

官方文档如下:

# step 1. download libfastcommon source codes and install it,
#   github address:  https://github.com/happyfish100/libfastcommon.git
#   gitee address:   https://gitee.com/fastdfs100/libfastcommon.git
# command lines as:

   git clone https://github.com/happyfish100/libfastcommon.git
   cd libfastcommon; git checkout V1.0.47
   ./make.sh clean && ./make.sh && ./make.sh install


# step 2. download fastdfs source codes and install it, 
#   github address:  https://github.com/happyfish100/fastdfs.git
#   gitee address:   https://gitee.com/fastdfs100/fastdfs.git
# command lines as:

   git clone https://github.com/happyfish100/fastdfs.git
   cd fastdfs; git checkout V6.07
   ./make.sh clean && ./make.sh && ./make.sh install


# step 3. setup the config files
#   the setup script does NOT overwrite existing config files,
#   please feel free to execute this script (take easy :)

./setup.sh /etc/fdfs


# step 4. edit or modify the config files of tracker, storage and client
such as:
 vi /etc/fdfs/tracker.conf
 vi /etc/fdfs/storage.conf
 vi /etc/fdfs/client.conf

 and so on ...


# step 5. run the server programs
# start the tracker server:
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

# start the storage server:
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

# (optional) in Linux, you can start fdfs_trackerd and fdfs_storaged as a service:
/sbin/service fdfs_trackerd restart
/sbin/service fdfs_storaged restart


# step 6. (optional) run monitor program
# such as:
/usr/bin/fdfs_monitor /etc/fdfs/client.conf


# step 7. (optional) run the test program
# such as:
/usr/bin/fdfs_test <client_conf_filename> <operation>
/usr/bin/fdfs_test1 <client_conf_filename> <operation>

# for example, upload a file for test:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/include/stdlib.h


tracker server config file sample please see conf/tracker.conf

storage server config file sample please see conf/storage.conf

client config file sample please see conf/client.conf

Item detail
1. server common items
---------------------------------------------------
|  item name            |  type  | default | Must |
---------------------------------------------------
| base_path             | string |         |  Y   |
---------------------------------------------------
| disabled              | boolean| false   |  N   |
---------------------------------------------------
| bind_addr             | string |         |  N   |
---------------------------------------------------
| network_timeout       | int    | 30(s)   |  N   |
---------------------------------------------------
| max_connections       | int    | 256     |  N   |
---------------------------------------------------
| log_level             | string | info    |  N   |
---------------------------------------------------
| run_by_group          | string |         |  N   |
---------------------------------------------------
| run_by_user           | string |         |  N   |
---------------------------------------------------
| allow_hosts           | string |   *     |  N   |
---------------------------------------------------
| sync_log_buff_interval| int    |  10(s)  |  N   |
---------------------------------------------------
| thread_stack_size     | string |  1M     |  N   |
---------------------------------------------------
memo:
   * base_path is the base path of sub dirs: 
     data and logs. base_path must exist and it's sub dirs will 
     be automatically created if not exist.
       $base_path/data: store data files
       $base_path/logs: store log files
   * log_level is the standard log level as syslog, case insensitive
     # emerg: for emergency
     # alert
     # crit: for critical
     # error
     # warn: for warning
     # notice
     # info
     # debug
   * allow_hosts can ocur more than once, host can be hostname or ip address,
     "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20]
      or host[01-08,20-25].domain.com, for example:
        allow_hosts=10.0.1.[1-15,20]
        allow_hosts=host[01-08,20-25].domain.com

2. tracker server items
---------------------------------------------------
|  item name            |  type  | default | Must |
---------------------------------------------------
| port                  | int    | 22000   |  N   |
---------------------------------------------------
| store_lookup          | int    |  0      |  N   |
---------------------------------------------------
| store_group           | string |         |  N   |
---------------------------------------------------
| store_server          | int    |  0      |  N   |
---------------------------------------------------
| store_path            | int    |  0      |  N   |
---------------------------------------------------
| download_server       | int    |  0      |  N   |
---------------------------------------------------
| reserved_storage_space| string |  1GB    |  N   |
---------------------------------------------------

memo: 
  * the value of store_lookup is:
    0: round robin (default)
    1: specify group
    2: load balance (supported since V1.1)
  * store_group is the name of group to store files.
    when store_lookup set to 1(specify group), 
    store_group must be set to a specified group name.
  * reserved_storage_space is the reserved storage space for system 
    or other applications. if the free(available) space of any stoarge
    server in a group <= reserved_storage_space, no file can be uploaded
    to this group (since V1.1)
    bytes unit can be one of follows:
      # G or g for gigabyte(GB)
      # M or m for megabyte(MB)
      # K or k for kilobyte(KB)
      # no unit for byte(B)

3. storage server items
-------------------------------------------------
|  item name          |  type  | default | Must |
-------------------------------------------------
| group_name          | string |         |  Y   |
-------------------------------------------------
| tracker_server      | string |         |  Y   |
-------------------------------------------------
| port                | int    | 23000   |  N   |
-------------------------------------------------
| heart_beat_interval | int    |  30(s)  |  N   |
-------------------------------------------------
| stat_report_interval| int    | 300(s)  |  N   |
-------------------------------------------------
| sync_wait_msec      | int    | 100(ms) |  N   |
-------------------------------------------------
| sync_interval       | int    |   0(ms) |  N   |
-------------------------------------------------
| sync_start_time     | string |  00:00  |  N   |
-------------------------------------------------
| sync_end_time       | string |  23:59  |  N   |
-------------------------------------------------
| store_path_count    | int    |   1     |  N   |
-------------------------------------------------
| store_path0         | string |base_path|  N   |
-------------------------------------------------
| store_path#         | string |         |  N   |
-------------------------------------------------
|subdir_count_per_path| int    |   256   |  N   |
-------------------------------------------------
|check_file_duplicate | boolean|    0    |  N   |
-------------------------------------------------
| key_namespace       | string |         |  N   |
-------------------------------------------------
| keep_alive          | boolean|    0    |  N   |
-------------------------------------------------
| sync_binlog_buff_interval| int |   60s |  N   |
-------------------------------------------------

memo:
  * tracker_server can ocur more than once, and tracker_server format is
    "host:port", host can be hostname or ip address.
  * store_path#, # for digital, based 0
  * check_file_duplicate: when set to true, must work with FastDHT server, 
    more detail please see INSTALL of FastDHT. FastDHT download page: 
    http://code.google.com/p/fastdht/downloads/list
  * key_namespace: FastDHT key namespace, can't be empty when 
    check_file_duplicate is true. the key namespace should short as possible

简化的步骤:

git clone https://gitee.com/fastdfs100/libfastcommon.git
cd libfastcommon
git checkout V1.0.48
./make.sh clean && ./make.sh && ./make.sh install

安装服务端

git clone https://gitee.com/fastdfs100/fastdfs.git
cd fastdfs
git checkout V6.07
./make.sh clean
./make.sh
[root@node01 fastdfs]# ./make.sh install
mkdir -p /usr/bin
mkdir -p /etc/fdfs
cp -f fdfs_trackerd /usr/bin
if [ ! -f /etc/fdfs/tracker.conf ]; then cp -f ../conf/tracker.conf /etc/fdfs/tracker.conf; fi
if [ ! -f /etc/fdfs/storage_ids.conf ]; then cp -f ../conf/storage_ids.conf /etc/fdfs/storage_ids.conf; fi
mkdir -p /usr/bin
mkdir -p /etc/fdfs
cp -f fdfs_storaged  /usr/bin
if [ ! -f /etc/fdfs/storage.conf ]; then cp -f ../conf/storage.conf /etc/fdfs/storage.conf; fi
mkdir -p /usr/bin
mkdir -p /etc/fdfs
mkdir -p /usr/lib64
mkdir -p /usr/lib
cp -f fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file fdfs_download_file fdfs_delete_file fdfs_file_info fdfs_appender_test fdfs_appender_test1 fdfs_append_file fdfs_upload_appender fdfs_regenerate_filename /usr/bin
if
FastDFS 环境搭建及使用详解 如题。 阅读详情

相关推荐

fastdfs安装部署整理

fastdfs

BIGmustang的博客 4833

单机版Fastdfs安装部署

一、软件包准备: 1、FastDFS_v5.05.tar.gz 2、libfastcommonV1.0.7.tar.gz 3、fastdfs-nginx-module_v1.16.tar.gz 4、nginx-1.10.2.tar.gz 二、确认环境端口是否可用,也可更换fastdfs默认端口 tracker使用:22122 storage使用:23000 ...

阿索的专栏 5308

CentOS安装部署FastDFS

建立/usr/bin到/usr/local/bin的软连接,FastDFS脚本设置的bin目录是/usr/local/bin,但实际命令安装在/usr/bin下。目录,复制 FastDFS 存储器样例配置文件 storage.conf.sample,并重命名为 storage.conf。启动成功之后在浏览器尝试访问之前上传的测试图片:http://ip:port/group1/M00/00/00/QQ.jpg。FastDFS安装成功后,会在/etc目录下会有个fdfs目录,进入fdfs,会有三个。

weixin_43417420的博客 1741

fastdfs-nginx-module的安装与部署

FastDFS的Nginx模块1 简介2 Nginx上部署FastDFS2.1 模块包的安装报错处理2.2 fastdfs-nginx-module 的配置2.2.1 fastdfs-nginx-module配置文件2.2.2 建立软连接2.2.3 配置nginx报错处理2.3 测试环境 1 简介 一个好的分布式文件系统最好提供Nginx的模块,因为对于互联网应用来说,像文件这种 静态资源,一般是通过HTTP的下载,此时通过容易扩展的Nginx来访问FastDFS,能够让 文件的上传和下载变得特别简单。 N

流楚丶格念的博客 5694

单台服务器安装部署fastdfs

一、安装依赖包:libevent[root@test-heji-web-165-217 src]# yum -y install libevent二、安装libfastcommon[root@test-heji-web-165-217 src]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.35.tar.gz [ro

zsl10的专栏 3512

fastdfs-安装部署fastdfs实现分布式文件系统(一)

在移动互联网时代,智能终端,包括手机,平板电脑,物联网的发展,个人产生的图片,视频文件,文档文件,其他数据已经非常的多,那么对于如何处理这些海量的数据,是一个非常重要的环节,一方面要保证数据的安全和完整性,同时又要能够容易的横向扩容的存贮系统升级。那么就需要用到分布式文件储存系统。 于是我开始寻找一个真正的分布式文件系统,来解决我的存储难题。一找才发现,市面上各种分布式文件系统品种繁多,层出

bingcool 3965

FastDFS+Nginx 集群安装部署

FastDFS安装 1. 环境准备 # 具体步骤 1. 环境配置(nginx,c++,压缩文件等配置) -- 1.1 2. 安装配置libfastcommon --- 1.4 3. 安装配置fastdfs --- 1.5 4. 安装配置fastdfs-nginx-modul模块 --- 1.6 5. 安装nginx --- 1.7 6. 重启 -- 4.2/4.3/4.4 1.1 使用的软件系统 名称 说明 centos 7.x (Linux 3.10.0-693.el7.x86_64

amelia_ 597

FastDFS资源服务器在Linux下的安装与部署全解

htmltable {th, td {th {pre {简介:FastDFS是一款轻量级分布式文件系统,针对大容量存储设计,尤其适合解决大数据和高并发访问问题。本部署包包含搭建FastDFS资源服务器所需的所有基本组件,适用于基于Red Hat或CentOS的Linux环境。

weixin_34413326的博客 1066

使用电荷放大器处理压电加速度计输出

电阻器 R p模拟传感器的绝缘电阻,为产生的电荷创建泄漏路径。在此图中,顶部波形显示传感器产生的电荷,而底部波形显示电荷放大器的输出。这需要具有大输入阻抗的放大级,以防止产生的电荷通过与传感元件并联的放大器的输入阻抗泄漏。换句话说,电荷放大器补偿传感器产生的电荷 q p ,反馈电容器 C F中具有相反极性的等量电荷。因此,任何与传感器并联的绝缘电阻,如电缆的绝缘电阻或传感器的漏电电阻Rp,都不能流过电流。漂移是指电荷放大器输出在一段时间内发生的变化,而不是由被测物理参数的变化(我们讨论的加速度)引起的。

weixin_45260069的博客 3905

WhatsApp API接口的隐秘角落:从协议解析到自定义消息引擎

本文深入解析WhatsApp API接口的隐秘角落,从协议逆向工程到自定义消息引擎开发实战。通过分析WhatsApp的二进制XML协议和加密机制,构建超越官方API限制的自定义消息引擎,实现高效、灵活的即时通讯解决方案。文章还提供了企业级架构设计和风控规避策略,助力开发者突破官方限制,提升消息到达率和成本效益。

q3r4s5t的博客 761

ARM CoreLink 系列 5.1.1 -- CI-700 System Address Map 】

所有的CHI 命令都包含一个 Source ID 和 Target ID, 其中 Source ID 可以来自于 RN Node, Target ID 可以来自于HN node或者其他 SN node. 其中 Target ID 是通过 SAM解析传入的地址得到的。对于 CI-700中的所有 RN Node 中的 SAM 多会进行配置,因为RN Node 访问的是整个地址空间,不同的地址空间会有不同的属性(I/O, DRAM),所以会对RN SAM 配置多个不同属性的区域。

CodingCos的博客 771

电磁兼容(EMC):一文读懂过电应力(EOS)

过电应力(EOS)是指元器件承受的电流或电压应力超过其允许的最大范围。产品的电磁兼容(EMC)失效的一种常见模型为过电应力(EOS),也是电子产品失效的最常见的情况之一。过电应力基本与半导体器件相关,EOS事件包括有:静电放电(ESD)、雷击、系统瞬态、电磁脉冲、充电等。本文将详细讨论一下产品设计中如何关注EOS设计。

linkking27的博客 6485

边缘AI工业落地:YOLO26-Seg + RK3588 NPU 极致部署(低功耗+实时实例分割,工业场景全覆盖)

本次实战汇总了「YOLO26-Seg+RK3588 NPU」工业边缘部署中最常见、最致命的8个坑点,所有坑点均来自真实工业项目,解决方案均为零代码/一键操作,无需复杂配置,能让你少走90%的弯路,节省大量时间,必看必记!❌ RKNN转换报错「算子不支持/模型加载失败」→ ✅ 导出ONNX时必须指定opset=12,重新导出即可,RK3588唯一兼容版本;❌ 分割mask错位/轮廓模糊 → ✅ 导出ONNX时加,并保证RKNN的归一化参数与YOLO26一致,零代码修复;

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1717

Vue3 - 详解实现网站接入钉钉扫码登录功能,钉钉授权生成登录二维码用户用手机扫描二维码登陆,支持弹框式、浏览器单独新开页显示,钉钉扫描二维码登录详细流程及示例代码,最新vue集成钉钉扫码授权登录!

vue3,nuxt3,钉钉,扫码登录,vue3钉钉扫码登陆,钉钉授权第三方WEB网站扫码登录功能,钉钉扫码登录第三方网站,单点登录,二维码不显示,报错,扫了没反应,出错,vue3钉钉扫码登录,内嵌,获取个人信息,pc网页钉钉登录,钉钉扫码登录怎么新开一页,跳页显示二维码,内嵌登录二维码,iframe新页面弹出,弹出一个小窗口显示登录二维码,登录报错,扫码没反应,解决手机点登录报错没反应,官方文档,手机扫描钉钉二维码登录网站,页面弹出一个小窗口而不是打开一个页面,vue3中使用iframe实现另开小窗口扫码登

🏆 前端领域优质创作者 3695

看28377代码笔记

使用的是20MHz外部晶振,为取200MHz系统时钟,倍频设为20,分频设为2,这样sysclock = 20MHz * 20 / 2,正好200MHz。注意:SPISTE配置成普通的GPIO端口,是为了更好控制芯片,配置芯片的时序。FMULT_0:小数点位数,小数只能有0,0.25,0.5,0.75四个选择。XTAL_OSC:表示使用外部晶振。GPIO_MUX_CPU1:复用类型。GPIO_MUX_CPU1:复用类型。PLLCLK_BY_2:表示2分频。IMULT_20:表示倍频数。

小柚子的博客 806

第3.1.3章 机器人第三方库实战总结:ROS 2 入门实战及和ROS1的对比,打通机器人开发的任督二脉

本文针对机器人SLAM开发中第三方库的学习痛点,重点介绍ROS 2在SLAM中的应用。文章首先对比ROS 1与ROS 2的核心差异,梳理ROS 2知识图谱,包括节点、话题、服务等核心概念。通过实战项目演示如何构建激光SLAM节点,结合代码详解运行流程。最后给出学习建议,强调动手实践的重要性,帮助开发者快速掌握ROS 2在SLAM开发中的关键应用。

行知SLAM 180

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

上一篇: ELK 遇到的问题汇总
下一篇: Nginx 动态负载均衡
LavenLiu
博客等级 码龄16年 639粉丝 90原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LavenLiu

常言道:投资效率是最大的投资。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值