zoukankan      html  css  js  c++  java
  • FastDFS安装使用实战三(使用篇)

    FastDFS安装使用实战三(使用篇)

    Keywords:FastDFS、分布式文件系统、Ubuntu

    Author:soartju

    转载请注明出处:http://soartju.iteye.com/blog/803548

    经过前面的安装、配置、启动,马上就可以看到FastDFS的效果了,我们先上传一个文件,然后再通过http下载。

    一、上传文件

    FastDFS安装包中,自带了客户端程序,通过程序可以进行文件上传。在使用这个客户端程序之前,首先需要配置client.conf,然后再进行文件上传及下载。

    1、修改%FastDFS%/conf/client.conf文件,修改如下: #可自定义,但此目录必须存在,用于存放文件上传log

    Txt代码 复制代码 收藏代码
    1. base_path=/home/yuqing/fastdfs-> base_path=/home/soar/fastdfs_tracker 
    base_path=/home/yuqing/fastdfs-> base_path=/home/soar/fastdfs_tracker
    Txt代码 复制代码 收藏代码
    1. tracker_server=192.168.209.121:22122 -> tracker_server=10.0.2.15:22122 
    tracker_server=192.168.209.121:22122 -> tracker_server=10.0.2.15:22122
    Txt代码 复制代码 收藏代码
    1. http.tracker_server_port=8080 ->http.tracker_server_port=8090 
    http.tracker_server_port=8080 ->http.tracker_server_port=8090

    #支持http

    Txt代码 复制代码 收藏代码
    1. ##include http.conf ->#include http.conf  
    ##include http.conf ->#include http.conf 

    2、进入/usr/local/bin/目录,上传文件,执行

    Txt代码 复制代码 收藏代码
    1. sudo fdfs_test %FastDFS%/conf/client.conf upload a.txt  
    sudo fdfs_test %FastDFS%/conf/client.conf upload a.txt 

    注:a.txt可以在/usr/local/bin/目录下自己创建一个

    如果命令行反馈类似如下:

    则说明上传文件成功。

    二、下载文件

    在浏览器中,输入上图中的url地址, tracker server会自动重定向到存储文件的storage server,文件下载成功。

    至此,已经成功搭建了FastDFS,编写你自己的client来进行访问吧:)

  • 相关阅读:
    MFC常见问题解惑
    VS2010之MFC串口通信的编写教程
    Visual C++ 开发心得与调试技巧
    WIN32 DLL中使用MFC
    c++ 类模版、成员函数模版、函数模版 用法
    【学术篇】浅谈各种邻接表
    【模板篇】树状数组们(四)
    【学术篇】网络流24题--飞行员配对方案问题
    【学术篇】网络流24题--骑士共存问题
    【模板篇】树状数组们(三)
  • 原文地址:https://www.cnblogs.com/fengchaowang/p/4135708.html
Copyright © 2011-2022 走看看