博客
关于我
fastdfs
阅读量:787 次
发布时间:2019-03-24

本文共 1651 字,大约阅读时间需要 5 分钟。

fastdfs—》分布式存储系统

fastdfs是一种分布式文件存储系统,适合存储视频、音频、图片和文档文件,支持文件的存储、上传、下载和删除等操作。fastdfs的架构分为三部分:客户端、跟踪服务器和存储节点。

fastdfs组成部分

  • 客户端:负责与fastdfs进行文件存储、上传、下载等操作,可通过配置文件指定存储目标。
  • 跟踪服务器:管理后端存储节点,对客户端的文件存储请求进行路由和分发。
  • 存储节点:实际存储文件的服务器节点,负责处理文件的存储、删除和检索请求。
  • fastdfs文件存储流程

    fastdfs采用分布式的存储方式,支持多组存储节点,每组节点数据完全相同,组间数据不重复。具体存储流程如下:

  • 客户端通过跟踪服务器确定目标存储组。
  • 存储节点接收文件,写入本地存储系统。
  • 客户端可通过 tracker 服务器获得文件的存储位置以便快速访问。
  • fastdfs安装准备

    操作步骤如下:

  • 确定服务器环境并准备7台虚拟机。
  • 安装必要软件包:
    yum -y install libtool autoconf automake pcre-devel zlib-devel openssl-devel gcc gcc-c++
  • 编译安装 fastcommon 和 fastdfs:
    cd libfastcommon/ && ./make.sh && ./make.sh install && cd ..cd fastdfs/ && ./make.sh && ./make.sh install && cd ..
  • 配置配置文件:
    cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.confcp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.confcp /etc/fdfs/client.conf.sample /etc/fdns/client.confcp fastdfs/conf/http.conf /etc/fdfs/cp fastdfs/conf/mime.types /etc/fdfs/
  • nginx配置与安装

  • 安装nginx:
    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --add-module=/usr/local/src/fastdfs-nginx-module/src/make && make install
  • 在第一台服务器安装完成后,开始配置nginx:
    nginx -c /etc/fdfs/http.conf
  • tracker服务器配置

    1.tracker服务器需要配置cluster文件:

    vi /etc/fdfs/cluster文件
    1. 具名IP指定后续三台服务器IP,并保存文件。
    2. ###.ExecuteScalar

    3. 上传文件命令:
      fdfs_upload_file /etc/fdfs/client.conf /root/test.jpg
    4. 查看文件:
      firefox http://tracker-ip/group2/M00/00/00/
    5. 下载文件命令:
      fdfs_download_file /etc/fdfs/client.conf group2/M00/00/00/test.jpg /root/test.jpg
    6. 删除文件命令:
      fdfs_delete_file /etc/fdfs/client.conf group2/M00/00/00/test.jpg
    7. 操作注意事项

    8. 后四台虚拟机上部署nginx,下载并运行后续脚本。2.tracker服务器的两台IP需预先配置好。
    9. 使用SCP命令将配置文件传输到后续三台服务器。
    10. 后四台服务器需要修改配置文件并重新启动服务。
    11. 确保所有服务均已启动后,测试文件上传和下载功能。

    转载地址:http://izgkk.baihongyu.com/

    你可能感兴趣的文章
    SSM(Spring+SpringMvc+Mybatis)整合开发笔记
    查看>>
    Orderer节点启动报错解决方案:Not bootstrapping because of 3 existing channels
    查看>>
    org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement profile
    查看>>
    sql查询中 查询字段数据类型 int 与 String 出现问题
    查看>>
    org.apache.commons.beanutils.BasicDynaBean cannot be cast to ...
    查看>>
    org.apache.dubbo.common.serialize.SerializationException: com.alibaba.fastjson2.JSONException: not s
    查看>>
    sqlserver学习笔记(三)—— 为数据库添加新的用户
    查看>>
    org.apache.http.conn.HttpHostConnectException: Connection to refused
    查看>>
    org.apache.ibatis.binding.BindingException: Invalid bound statement错误一例
    查看>>
    org.apache.ibatis.exceptions.PersistenceException:
    查看>>
    org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned
    查看>>
    org.apache.ibatis.type.TypeException: Could not resolve type alias 'xxxx'异常
    查看>>
    org.apache.poi.hssf.util.Region
    查看>>
    org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions;
    查看>>
    org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
    查看>>
    org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    查看>>
    org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
    查看>>
    org.springframework.boot:spring boot maven plugin丢失---SpringCloud Alibaba_若依微服务框架改造_--工作笔记012
    查看>>
    SQL-CLR 类型映射 (LINQ to SQL)
    查看>>
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
    查看>>