启动管理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. 12.Android-SQLiteOpenHelper使用

    1.SQLite介绍 SQLite,是一款轻型的数据库,它的优缺点有如下: 轻量级,适合嵌入式设备,并且本身不依赖第三方的软件,使用它也不需要“安装”. 并发(包括多进程和多线程)读写方面的性能不太理 ...

  2. 计算机基础——常用的Dos命令

    d:——切换指定硬盘分区 cd——切换目录,例如:cd D:\下载(使用此命令之前先使用 d: 命令) netstat -ano——查看所有端口号 netstat -a——查看开启了哪些端口 nets ...

  3. 批量解决win10图标上有两个蓝色箭头的方法

    双击“此电脑”,点击“C盘”,可以看到一个”用户“文件夹,双击”用户“, 选择现在正在使用的用户名,双击用户名,找到该文件夹下的”桌面“或”Desktop“点击“属性”, 在“常规”选项卡中的属于项中 ...

  4. 基本库使用(urllib,requests)

    urllib(request,error,parse,robotparse) request模块 方法:urlopen()    {read(),readinto(),getheader(name), ...

  5. rtmp协议规范

    译序: 本文是为截至发稿时止最新 Adobe 官方公布的 RTMP 规范.本文包含 RTMP 规范的全部内容.是第一个比较全面的 RTMP 规范的中译本.由于成文时间仓促,加上作者知识面所限,翻译错误 ...

  6. SpringBoot + Mybatis 和ssm 使用数据库的区别

    积少成多 ----  仅以此致敬和我一样在慢慢前进的人儿 相关内容: https://www.cnblogs.com/h-c-g/p/10252121.html 引 言 接触SpringBoot 后, ...

  7. react中 如何使用图片

    //render 第一种方法:先const一个对象,把需要应用图片的dom上的style写入对象中, 然后在return()中使用style关键字赋值为预先定义的那个style对象 const bgG ...

  8. 理解numpy中ndarray的内存布局和设计哲学

    目录 ndarray是什么 ndarray的设计哲学 ndarray的内存布局 为什么可以这样设计 小结 参考 博客:博客园 | CSDN | blog 本文的主要目的在于理解numpy.ndarra ...

  9. Solaris磁盘镜像恢复

    注:此文章笔者实验记录,欢迎大家指正 Solaris磁盘镜像恢复方法一: 系统启动,开机提示子镜像需要维护: 查看磁盘镜像信息 进入系统后,metastat -pc 和metadb #查看镜像状态与m ...

  10. js代码预解析

    1.var一般用于声明变量,预解析代码的时候,等号后面的赋值过程不会执行,所以预解析时的var变量都是未定义的 2.function声明的函数,预解析的时候,值就是函数里面的内容 例:console. ...