管理 使用 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 ...
随机推荐
- Spring学习记录6——ThreadLocal简介
Spring通过各种模板类降低了开发者使用各种数据持久化技术的难度.这些模板类是线程安全的,所以 多个DAO可以复用同一个模板实例而不会发生冲突.在使用模板类访问底层数据时,模板类需要绑定数据连接或者 ...
- hadoop各版本hadoop.dll和winutils.exe缺少这两个文件
1.1 缺少winutils.exeCould not locate executable null \bin\winutils.exe in the hadoop binaries1.2 缺少had ...
- 三分钟网络基础-IP地址分类
IP 地址的编址方法共经过了三个历史阶段: 分类的 IP 地址 子网的划分 超网 这篇文章首先介绍,最初始的 IP 地址分类方法. 分类的 IP 将 IP 地址划分为若干个固定类,每一类地址都由两个固 ...
- 出现An App ID with Identifier 'com.XXX.XXX’ is not available. Please enter a different string.
解决方法: 1.移除钥匙串中的开发证书,重新导入, 完全关闭Xcode; 2.再次打开Xcode,通过 Preferences - View Details - download 新的证书: 3.选择 ...
- path_info和get_full_path()的区别
1.get_full_path() 获取的url路径包含参数 2.path_info 获取的路径不包含参数 注意:获取的路径都不包含协议 IP 和端口 3.补充 sesssion http://127 ...
- c#数字图像处理(六)直方图均衡化
直方图均衡化又称直方图修平,是一种很重要的非线性点运算.使用该方法可以加强图像的局部对比度,尤其是当图像的有用数据的对比度相当接近的时候.通过这种方法,亮度可以更好的在直方图上分布. 直方图均衡化的基 ...
- cnblogs 美化主题
Silence主题 一个简洁的主题, 不带广告,我很喜欢 cnblogs 域名解析 这需要注意一点是:github.io项目名需要和用户名一致才能正确访问,否则会报404 Markdown格式化编辑 ...
- 贪心+huffman编码+模拟退火+分治(一)
(一)贪心 1.A - 今年暑假不AC “今年暑假不AC?” “是的.” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%...” 确实如此,世界杯来了,球迷的节日也来了,估计很 ...
- win10系统下自由切换桌面
说明: win10系统下自由切换桌面,确认在win10系统下操作进行. 方法: 1.快捷键:ctrl+win键(开始键)+方向键(左/右) 2.桌面最下面的状态栏,点击红框
- 报错requests.exceptions.InvalidSchema: No connection adapters were found for
刚开始学习,使用requests时,敲了点demo import requests params = { "name": "name", "passw ...