banjina 发表于 2015-9-10 10:27:30

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

FastDFS安装使用实战三(使用篇)
  Keywords:FastDFS、分布式文件系统、Ubuntu
  Author:soartju
  转载请注明出处:http://soartju.iteye.com/blog/803548
  
  
  经过前面的安装、配置、启动,马上就可以看到FastDFS的效果了,我们先上传一个文件,然后再通过http下载。

一、上传文件
  FastDFS安装包中,自带了客户端程序,通过程序可以进行文件上传。在使用这个客户端程序之前,首先需要配置client.conf,然后再进行文件上传及下载。
  
  1、修改%FastDFS%/conf/client.conf文件,修改如下: #可自定义,但此目录必须存在,用于存放文件上传log


[*]base_path=/home/yuqing/fastdfs-> base_path=/home/soar/fastdfs_tracker

base_path=/home/yuqing/fastdfs-> base_path=/home/soar/fastdfs_tracker

[*]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

[*]http.tracker_server_port=8080 ->http.tracker_server_port=8090

http.tracker_server_port=8080 ->http.tracker_server_port=8090
  #支持http


[*]##include http.conf ->#include http.conf

##include http.conf ->#include http.conf
  2、进入/usr/local/bin/目录,上传文件,执行


[*]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来进行访问吧:)
页: [1]
查看完整版本: FastDFS安装使用实战三(使用篇)