管理 使用 FastDFS
/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
data logs
data下 fdfs_trackerd.pid 记录程序运行的pid
storage_changelog.dat 记录更新的stroage情况
storage_groups_new.dat 存储分组信息 (group_count=0)
logs下 trackerd.log 日志文件 记录启动停止等信息
例如 记载启动信息:
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必须事先已启动)
fdfs_storaged <config_file> [start | stop | restart]
2.
service+文件+命令(需要配置)
/sbin/service fdfs_storaged start
启动成功后 base_path 路径下生成以下文件夹
data logs
data下 fdfs_storaged.pid 记录程序运行的pid
storage_stat.dat 当前storage server统计信息 (上传下载)
sync 存放数据同步相关文件
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
注意:以下使用的 fdfs_test程序 为测试使用,不要用在正式环境!
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
#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的更多相关文章
- 分布式文件系统FastDFS如何做到高可用
FastDFS是用C语言编写的一款开源的轻量级分布式文件系统.它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的 ...
- (转)淘淘商城系列——分布式文件系统FastDFS
http://blog.csdn.net/yerenyuan_pku/article/details/72801777 商品添加的实现,包括商品的类目选择,即商品属于哪个分类?还包括图片上传,对于图片 ...
- python面试题(三)
一.项目技术点梳理 (一)Django项目 本项目是用python的Django框架开发的前后端不分离项目.项目采用MVT架构,使用的MySQL和redis数据库,用Django自带的orm与数据库交 ...
- SpringBoot2.0 整合 FastDFS 中间件,实现文件分布式管理
本文源码:GitHub·点这里 || GitEE·点这里 一.FastDFS简介 1.FastDFS作用 FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步 ...
- 阶段5 3.微服务项目【学成在线】_day08 课程图片管理 分布式文件系统_06-分布式文件系统研究-fastDFS安装及配置文件说明
3 fastDFS入门 3.1fastDFS安装与配置 3.1.1 导入虚拟机 对fastDFS的安装过程不要求学生掌握,可以直接导入老师提供虚拟机. 1.使用Vmware打开虚拟机配置文件“Cent ...
- (十一)整合 FastDFS 中间件,实现文件分布式管理
整合 FastDFS 中间件,实现文件分布式管理 1.FastDFS简介 1.1 核心角色 1.2 运转流程 2.SpringBoot整合FastDFS 2.1 核心步骤 2.2 核心依赖 2.3 配 ...
- fastdfs-zyc管理FastDFS的web界面
俩压缩包根据大小重命名以下,按图片所示 把1_fastdfs-zyc.7z重命名为fastdfs-zyc.7z.001 把2_fastdfs-zyc.7z重命名为fastdfs-zyc.7z.002 ...
- 【架构设计】分布式文件系统 FastDFS的原理和安装使用
本文地址 分享提纲: 1.概述 2. 原理 3. 安装 4. 使用 5. 参考文档 1. 概述 1.1)[常见文件系统] Google了一下,流行的开源分布式文件系统有很多,介绍如下: -- mo ...
- FASTDFS调研报告(V1.0)
之前的文章,现在放出来,以供参阅. 一.fastdfs简介 FastDFS是一个轻量级的开源分布式文件系统 FastDFS主要解决了大容量的文件存储和高并发访问的问题,文件存取时实现了负载均衡 Fas ...
随机推荐
- cogs 2450. 距离 树链剖分求LCA最近公共祖先 快速求树上两点距离 详细讲解 带注释!
2450. 距离 ★★ 输入文件:distance.in 输出文件:distance.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述] 在一个村子里有N个房子,一 ...
- 定时器之Quart.net(2)
第一步:Install-Package Quartz namespace ProjectEdb { class Program { static void Main(string[] args) { ...
- 关于在读取excel的文件时候,放在服务器上就报路径错误
就是指定这个路径:C:\Program Files (x86)\IIS Express 因为在上传到服务器的时候,服务器读取的是在服务器上的路径,所以正确的思路应该是 把上传的Excel存在服务器上, ...
- Python中的open()方法总结
总结Python中的open()方法 message= {'企业即时通信': 'aaa', '企业名称': 'bbb'} with open("..\\r.txt", " ...
- matplotlib 直方图
一.特点 数据必须是原始数据不能经过处理,数据连续型,显示一组或多组分布数据 histogram 直方图 normed 定额 二.核心 hist(x, bins=None, normed=None) ...
- 1. RevitAPI 基础(上)
一 重要的基本设置: 1. 类库:revitAPI.DLL, revitAPIUI.DLL,个人理解前者包括了revit软件所特有的数据类型及软件中存在的全部后台数据,而后者是包含了大量与实现UI交互 ...
- Python中关于__main__变量的问题
在Python代码的编写中,经常会用到这么一句: if __name__ == "__main__": .... 这句代码之前的语句在整个模块被其他文件调用的时候会被运行,而这句代 ...
- ASP.Net Core 发布到IIS Http Error 502.5 官方解决办法
Http Error 502.5 - Process Failure 在IIS上发布.NET Core程序出现这个错误.网上搜索到的办法为什么总行不通呢? 有可能年代久远,现在的环境与当年不同,所以解 ...
- zbar+opencv检测图片中的二维码或条形码
zbar本身自带检测二维码条形码功能,这里使用opencv只是做一些简单的读取图片,灰度图片以及显示条形码和二维码时用到一些绘制 // barcode-qrcodescanner.cpp: 定义控制台 ...
- ios--->帧动画
帧动画 NSMutableArray<UIImage *> *imageArr=[NSMutableArray array]; for(int i=0;i<20;i++){ NSSt ...