• 搭建单机版FastDFS分布式文件存储系统


    一、准备工作

    1、下载FastDFS安装包和依赖包

    https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.43
    https://codeload.github.com/happyfish100/fastdfs/tar.gz/V6.06
    https://codeload.github.com/happyfish100/fastdfs-nginx-module/tar.gz/V1.22

    注:可以使用window浏览器(下载后需要上传到服务器上),也可以使用linux的curl命令

    1. curl -o libfastcommon-1.0.43.tar.gz https://codeload.github.com/happyfish100/libfastcommon/tar.gz/V1.0.43
    2. curl -o fastdfs-6.06.tar.gz https://codeload.github.com/happyfish100/fastdfs/tar.gz/V6.06
    3. curl -o fastdfs-nginx-module-1.22.tar.gz https://codeload.github.com/happyfish100/fastdfs-nginx-module/tar.gz/V1.22

    2、下载nginx,可以结合fastdfs-nginx-module插件,在浏览器上访问文件

    nginx: download页面

    注:也可以使用curl命令直接下载到linux服务器上,这里使用的nginx版本是1.22

    curl -O http://nginx.org/download/nginx-1.22.1.tar.gz 

    3、在/usr/local目录下创建fastdfs文件夹,并将下载的文件解压到该目录下,删除压缩包(减少存储占用,推荐)。

    1. mkdir /usr/local/fastdfs
    2. tar -zxvf fastdfs-6.06.tar.gz -C /usr/local/fastdfs
    3. tar -zxvf fastdfs-nginx-module-1.22.tar.gz -C /usr/local/fastdfs
    4. tar -zxvf libfastcommon-1.0.43.tar.gz -C /usr/local/fastdfs
    5. tar -zxvf nginx-1.22.1.tar.gz -C /usr/local/fastdfs
    6. rm -rf fastdfs-6.06.tar.gz fastdfs-nginx-module-1.22.tar.gz libfastcommon-1.0.43.tar.gz nginx-1.22.1.tar.gz

    4、安装依赖,如果linux环境中有perl,则无需安装,否者需要安装

    yum -y install gcc-c++ libevent pcre pcre-devel zlib zlib-devel openssl openssl-devel perl

     二、安装fastdfs的依赖包 libfastcommon

    1、进入/usr/local/fastdfs/libfastcommon-1.0.43目录下,执行编译安装

    1. ./make.sh # 编译
    2. ./make.sh install # 安装

    三、安装fastdfs包

    1、进入到/usr/local/fastdfs/fastdfs-6.06目录下,执行编译安装

    1. ./make.sh # 编译
    2. ./make.sh install # 安装

    2、执行编译安装命令之后,如果不报错的话,软件会被安装到/et/fdfs目录下,将/usr/local/fastdfs/fastdfs-6.06/conf目录下的所有文件复制到/et/fdfs目录下

    cp /usr/local/fastdfs/fastdfs-6.06/conf/* /et/fdfs

    3、创建tracker文件夹(存储路径使用)

    mkdir -p /home/fastdfs/tracker

    4、进入到/et/fdfs目录下修改tracker.conf文件

    修改前:

    22 # the base path to store data and log files

    23 base_path = /home/yuqing/fastdfs
    修改后:

    22 # the base path to store data and log files

    23 base_path = /home/fastdfs/tracker

    5、启动tracker服务(跟踪器)

    /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

    6、创建storage文件夹

    mkdir -p /home/fastdfs/storage

    7、进入到/et/fdfs目录下修改storage.conf文件

    修改前:

    48 #       eg. the disk free space should > 50GB

    49 base_path =  /home/yuqing/fastdfs # 默认存储路径


    127 #       the base_path should be independent (different) of the store paths
    128 
    129 store_path0 = /home/yuqing/fastdfs  # 默认存储路径


    143 #   another eg.: 192.168.1.10,172.17.4.21:22122
    144 
    145 tracker_server = 192.168.209.121:22122
    146 tracker_server = 192.168.209.122:22122

    修改后:

    48 #       eg. the disk free space should > 50GB

    49 base_path =  /home/fastdfs/storage


    127 #       the base_path should be independent (different) of the store paths
    128 
    129 store_path0 = /home/fastdfs/storage


    143 #   another eg.: 192.168.1.10,172.17.4.21:22122
    144 
    145 tracker_server = 本地IP:22122
    146 tracker_server = 本地IP:22122

    8、启动storage服务(存储器)

    /usr/bin/fdfs_storaged /etc/fdfs/storage.conf

    9、创建client文件夹(客户端)

    mkdir -p /home/fastdfs/client/

    10、进入到/et/fdfs目录下修改client.conf文件

    修改前:

    10 # the base path to store log files
    11 base_path = /home/yuqing/fastdfs


    20 #   another eg.: 192.168.1.10,172.17.4.21:22122
    21 
    22 tracker_server = 192.168.0.196:22122
    23 tracker_server = 192.168.0.197:22122
    修改后:

    # the base path to store log files
    base_path = /home/fastdfs/client


    #   another eg.: 192.168.1.10,172.17.4.21:22122

    tracker_server = 本地IP:22122
    #tracker_server = 192.168.0.197:22122

     11、测试系统是否可用

    fdfs_test /etc/fdfs/client.conf upload storage.conf 

     四,安装并配置nginx,(可浏览器访问)

    1、进入到 /usr/local/fastdfs/nginx-1.22.1文件下

    1. #配置nginx --prefix 安装目录,--with-http_ssl_module 使用ssl模块,--add-module 使用nginx插件
    2. ./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=/usr/local/fastdfs/fastdfs-nginx-module-1.22/src

    2、编译并安装nginx 

    make && make install

     3、nginx安装目录/usr/local/nginx

    4、配置nginx.conf文件

     

    5、启动nginx,并访问浏览器,当我们访问文件地址的时候,会直接下载

  • 相关阅读:
    光伏并网逆变器低电压穿越技术研究(Simulink仿真)
    基于纯前端类Excel表格控件实现在线损益表应用
    web网页设计期末课程大作业 基于HTML+CSS+JavaScript制作八大菜系介绍舌尖上的美食5页
    【计算机网络笔记】网络层服务模型——虚电路网络
    产品经理进阶:如何写商业计划书?
    规模化、可复制的大模型应用——企业知识管家
    【HDFS】处理状态为RECEIVING_BLOCK的增量块汇报
    Spring Cloud Nacos实现动态配置加载的源码分析
    小米汽车超级工厂智能物流
    用Python上傳api資料
  • 原文地址:https://blog.csdn.net/qq_42336581/article/details/132670301