启动管理tracker:

1.
启动文件+配置文件+命令
/usr/bin/fdfs_trackerd <config_file> [start | stop | restart]
举例:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start 
2.
service+文件+命令(需要配置)
/sbin/service fdfs_trackerd start
启动如果报错,请先检查配置文件中的 base_path=xxx   这个文件夹是否创建
启动成功后 base_path 路径下生成以下文件夹 
 data    logs
     data下 fdfs_trackerd.pid                  记录程序运行的pid
                  storage_changelog.dat        记录更新的stroage情况
                  storage_groups_new.dat     存储分组信息                               (group_count=0)
                  storage_servers_new.dat     存储服务器(storage)列表     (storage_count=0)
                  storage_sync_timestamp.dat

logs下 trackerd.log                      日志文件  记录启动停止等信息

例如 记载启动信息:

[2016-10-26 10:16:00] INFO - FastDFS v5.05, base_path=/home/fastdfs_tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1,
work_threads=4, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1,
storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20
GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0,
store_slave_file_use_link=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s

启动管理storage:
                  (启动storage server的前提是tracker server必须事先已启动)

1.
启动文件+配置文件+命令

 fdfs_storaged <config_file> [start | stop | restart]

举例: /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
2.
service+文件+命令(需要配置)
/sbin/service fdfs_storaged start

启动成功后 base_path 路径下生成以下文件夹 
 data    logs
       data下    fdfs_storaged.pid        记录程序运行的pid
                       storage_stat.dat          当前storage server统计信息 (上传下载)
                       sync                               存放数据同步相关文件

      logs下                                            日志文件
我将数据存放设置到/home/fastdfs_date
    storage启动后 在/home/fastdfs_date下创建 data文件夹 
       在data中创建了 256个存放数据文件的一级目录,目录名为十六进制字符,如:00, 1F
       每个一级目录下又创建256个存放数据文件的二级目录目录,目录名为十六进制字符,如:0A, CF

使用FastDFS:
fastdfs命令
  fdfs_trackerd            启动tracker
  fdfs_storaged           启动storage
  fdfs_monitor             监控
 
  fdfs_upload_file          上传
  fdfs_download_file     下载
  fdfs_delete_file           删除文件
  fdfs_file_info                查看上传文件的信息
  fdfs_crc32                    获取文件CRC

fdfs_test                     功能测试(参见上一篇)
  fdfs_test1                   功能测试(参见上一篇)
fdfs_appender_test                 appender上传测试  (产生两个文件 原文件 和属性文件)                                               fdfs_appender_test1               appender上传测试  (产生两个文件 原文件 和属性文件 )  

         
fdfs_upload_appender       上传断点文件  可以后续继续上传(独立存储,appender file不能被合并存储到trunk file)
fdfs_append_file                   对以创建的文件进行append操作   追加内容

1.上传  fdfs_upload_file   <config_file>   <local_filename>   [storage_ip:port] [store_path_index]
             # ./fdfs_upload_file /etc/fdfs/client.conf /root/51.29.txt
                  打印信息,是文件上传路径与文件名:
               group1/M00/00/00/CgAH2Fgr06mAYTveAAADeLE3ZJc.29.txt
2.下载 fdfs_download_file <config_file> <file_id> [local_filename] [<download_offset> <download_bytes>]
           直接下载(当前目录)
           #./fdfs_download_file /client.conf group1/M00/00/00/CgAH2Fgr06mAYTveAAADeLE3ZJc.29.txt
           重命名下载 到 (当前目录)
           # ./fdfs_download_file /client.conf group1/M00/00/00/CgAH2Fgr06mAYTveAAADeLE3ZJc.29.txt  A.TXT
           选定目录下载
    # ./fdfs_download_file /client.conf group1/M00/00/00/CTveAAADeLE3ZJc.29.txt  /usr/A.TXT
      
3.删除 fdfs_delete_file <config_file> <file_id>
          # ./fdfs_delete_file /client.conf  group1/M00/00/00/CgAH2AAADeLE3ZJc.29.txt
4.查看上传文件信息   fdfs_file_info <config_file> <file_id>        
      # ./fdfs_file_info /etc/fdfs/client.conf group1/M00/00/00/CgAH2Fgr06mAYTveAAADeLE3ZJc.29.txt
             source storage id: 0             source ip address: 10.0.7.216             file create timestamp: 2016-11-16 11:34:01            file size: 888            file crc32: 2973197463 (0xB1376497)

5.获取文件CRC   fdfs_crc32 <filename>
            # ./fdfs_crc32 CgAH2Fgr06mAYTveAAADeLE3ZJc.29.txt
             2973197463

6.upload_appender     上传断点文件        
                fdfs_upload_appender <config_file> <local_filename>

                      上传文件 (独立存储,appender file不能被合并存储到trunk file) 
                      # fdfs_upload_appender /etc/fdfs/client.conf /root/1.txt 
                      group1/M00/00/00/CgAH2Fgub0uEM6a-AAAAAAV96LM493.txt
7.断点上传  fdfs_append_file
                  fdfs_append_file <config_file> <appender_file_id> <local_filename>

                                                                              已上传的                  本地需要继续上传的

8.监控系统状态  可以监控查看运行状态  
fdfs_monitor <config_file> [-h <tracker_server>] [list|delete|set_trunk_server <group_name> [storage_id]]

   举例:/usr/bin/fdfs_monitor /etc/fdfs/client.conf 

9.测试程序
安装好后,可以先测试一下fastdfs的功能
注意:以下使用的 fdfs_test程序 为测试使用,不要用在正式环境!
9.1  appender测试     
         fdfs_appender_test <config_file> <local_filename> [FILE | BUFF | CALLBACK]
         fdfs_appender_test1 <config_file> <local_filename> [FILE | BUFF | CALLBACK]
     会上传产生两个文件 原文件 和属性文件
                      CgAH2FguakWEQQCFAAAAAAV96LM005.txt   原文件
                      CgAH2FguakWEQQCFAAAAAAV96LM005.txt-m   文件的属性
                                属性文件中一般存储        ext_name jpg     file_size 115120      height 80      width160
 9.2普通测试
#run the client test program:
       /usr/bin/fdfs_test    <client_conf_filename>   <operation>
       /usr/bin/fdfs_test1   <client_conf_filename>   <operation>
 operation: upload, download, getmeta, setmeta, delete and query_servers
                      上传   下载   获取文件属性 设置属性   删除        查询服务器信息

1.上传    /usr/bin/fdfs_test  conf/client.conf   upload  /usr/include/123.png
     2.下载    fdfs_test  /client.conf   download    group1    M00/00/00/AAADeLE3ZJc.29.txt
                 (下载文件到当前目录)
     3.获取属性    fdfs_test /client.conf getmeta group1 M00/00/00/AAADeLE3ZJc.29.txt    
     4.设置属性     ./fdfs_test <config_file> setmeta <group_name> <remote_filename> <op_flag> <metadata_list>
        op_flag: O for overwrite, M for merge      
       metadata_list: name1=value1,name2=value2,...    
     5.删除     fdfs_test /client.conf delete group1 M00/00/00/AAADeLE3ZJc.29.txt

storage=10.0.7.216:23000      delete file success

 
     6.查询服务器信息  fdfs_test  /client.conf query_servers group1 M00/00/00/AAADeLE3ZJc.29.txt
                                                server list (1):
                                                10.0.7.216:23000

9.2.1 的上传信息
[2016-10-26 14:24:47] DEBUG - base_path=/home/client, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage
server id count: 0

tracker_query_storage_store_list_without_group: 
server 1. group_name=, ip_addr=10.0.7.216, port=23000
group_name=group1, ip_addr=10.0.7.216, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/CgAH2FgQTC-ATZqrAAAhBUmzLaA086.png
source ip address: 10.0.7.216
file timestamp=2016-10-26 14:24:47
file size=8453
file crc32=1236479392
example file url: http://10.0.7.216/group1/M00/00/00/CgAH2FgQTC-ATZqrAAAhBUmzLaA086.png
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/CgAH2FgQTC-ATZqrAAAhBUmzLaA086_big.png
source ip address: 10.0.7.216
file timestamp=2016-10-26 14:24:47
file size=8453
file crc32=1236479392
example file url: http://10.0.7.216/group1/M00/00/00/CgAH2FgQTC-ATZqrAAAhBUmzLaA086_big.png

这两个是FastDFS自带的测试程序,会对一个文件上传两次,分别作为主文件和从文件。返回的文件ID也是两个。
   并且会上传文件附加属性,storage server上会生成4个文件。
   这两个程序仅用于测试目的,请不要用作实际用途。
   V2.05提供了比较正式的三个小工具:
      上传文件:/usr/local/bin/fdfs_upload_file  <config_file> <local_filename>
      下载文件:/usr/local/bin/fdfs_download_file <config_file> <file_id> [local_filename]
       删除文件:/usr/local/bin/fdfs_delete_file <config_file> <file_id>
                      
9.2.2 的下载信息
[root@localhost bin]# ./fdfs_test /etc/fdfs/client.conf download group1 M00/00/00/CgAH2Fgrg4eADNYWAAADeLE3ZJc.29.txt
This is FastDFS client test program v5.05

Copyright (C) 2008, Happy Fish / YuQing

FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/ 
for more detail.

[2016-11-16 05:53:35] DEBUG - base_path=/home/client, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage
server id count: 0

storage=10.0.7.216:23000
download file success, file size=888, file save to CgAH2Fgrg4eADNYWAAADeLE3ZJc.29.txt

9.2.3 的获取属性 # ./fdfs_test /etc/fdfs/client.conf getmeta group1 M00/00/00/CgAH2Fgrg4eADNYWAAADeLE3ZJc.29.txtstorage=10.0.7.216:23000get meta data success, meta count=4ext_name=jpgfile_size=115120height=80width=160

其它……略

管理 使用 FastDFS的更多相关文章

  1. 分布式文件系统FastDFS如何做到高可用

    FastDFS是用C语言编写的一款开源的轻量级分布式文件系统.它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的 ...

  2. (转)淘淘商城系列——分布式文件系统FastDFS

    http://blog.csdn.net/yerenyuan_pku/article/details/72801777 商品添加的实现,包括商品的类目选择,即商品属于哪个分类?还包括图片上传,对于图片 ...

  3. python面试题(三)

    一.项目技术点梳理 (一)Django项目 本项目是用python的Django框架开发的前后端不分离项目.项目采用MVT架构,使用的MySQL和redis数据库,用Django自带的orm与数据库交 ...

  4. SpringBoot2.0 整合 FastDFS 中间件,实现文件分布式管理

    本文源码:GitHub·点这里 || GitEE·点这里 一.FastDFS简介 1.FastDFS作用 FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步 ...

  5. 阶段5 3.微服务项目【学成在线】_day08 课程图片管理 分布式文件系统_06-分布式文件系统研究-fastDFS安装及配置文件说明

    3 fastDFS入门 3.1fastDFS安装与配置 3.1.1 导入虚拟机 对fastDFS的安装过程不要求学生掌握,可以直接导入老师提供虚拟机. 1.使用Vmware打开虚拟机配置文件“Cent ...

  6. (十一)整合 FastDFS 中间件,实现文件分布式管理

    整合 FastDFS 中间件,实现文件分布式管理 1.FastDFS简介 1.1 核心角色 1.2 运转流程 2.SpringBoot整合FastDFS 2.1 核心步骤 2.2 核心依赖 2.3 配 ...

  7. fastdfs-zyc管理FastDFS的web界面

    俩压缩包根据大小重命名以下,按图片所示 把1_fastdfs-zyc.7z重命名为fastdfs-zyc.7z.001 把2_fastdfs-zyc.7z重命名为fastdfs-zyc.7z.002 ...

  8. 【架构设计】分布式文件系统 FastDFS的原理和安装使用

    本文地址 分享提纲: 1.概述 2. 原理 3. 安装 4. 使用 5. 参考文档 1. 概述 1.1)[常见文件系统] Google了一下,流行的开源分布式文件系统有很多,介绍如下:   -- mo ...

  9. FASTDFS调研报告(V1.0)

    之前的文章,现在放出来,以供参阅. 一.fastdfs简介 FastDFS是一个轻量级的开源分布式文件系统 FastDFS主要解决了大容量的文件存储和高并发访问的问题,文件存取时实现了负载均衡 Fas ...

随机推荐

  1. 使用ajax向后台发送请求跳转页面无效的原因

    Ajax只是利用脚本访问对应url获取数据而已,不能做除了获取返回数据以外的其它动作了.所以浏览器端是不会发起重定向的. 1)正常的http url请求,只有浏览器和服务器两个参与者.浏览器端发起一个 ...

  2. 小白学Java:奇怪的RandomAccess

    目录 小白学Java:奇怪的RandomAccess RandomAccess是个啥 forLoop与Iterator的区别 判断是否为RandomAccess 小白学Java:奇怪的RandomAc ...

  3. Docker学习(三)认识Docker和常用命令

    Docker学习(三)认识Docker和常用命令 Docker体系结构 docker服务端,作为服务的提供方,核心进程 docker daemon,所有docker命令都是通过这个进程完成的 REST ...

  4. java异步调用方法

    一.利用多线程 直接new线程 Thread t = new Thread(){ @Override public void run() { longTimeMethod(); } }; 使用线程池 ...

  5. 创建dynamics CRM client-side (七) - 用JS 来控制Auto-Save

    在我们的system setting里面, 我们可以设置打开/关闭 auto save的功能. 我们可以用js来控制auto-save this.formOnSave = function (exec ...

  6. ssh隧道使用

    在内网中几乎所有的linux服务器和网络设备都支持ssh协议.一般情况下,ssh协议是允许通过防火墙和边界设备的,所以经常被攻击者利用.同时ssh协议的传输过程是加密的,所以我们很难区分合法的ssh会 ...

  7. 1、通过CP数据文件的方式恢复MySQL 从库 启动后报错:Last_IO_Errno: 1236:A slave with the same server_uuid/server_id as this slave has connected to the master;

    1.问题: MySQL从库中查看主从状态: show slave status\G,发现出现IO的报错: Last_IO_Errno: Last_IO_Error: Got fatal error f ...

  8. CSS 故障艺术

    本文的主题是 Glitch Art,故障艺术. 什么是故障艺术?我们熟知的抖音的 LOGO 正是故障艺术其中一种表现形式.它有一种魔幻的感觉,看起来具有闪烁.震动的效果,很吸引人眼球. 故障艺术它模拟 ...

  9. python笔记15

    今日内容 模块知识 内置模块 time datetime json 其他 内容回顾 & 作业题 重要知识点 构造字典和函数对应关系,避免重复的if else a=1 b=2 ==> a, ...

  10. ICC教程 - Flow系列 - 概念系列 - ECO (理论+实践+脚本分享)

    本文转自:自己的微信公众号<集成电路设计及EDA教程> <ICC教程 - Flow系列 - 概念系列 - ECO (理论+实践+脚本分享)> 这篇推文讲一下数字IC设计中的po ...