我是靠谱客的博主 拉长盼望,最近开发中收集的这篇文章主要介绍Fastdfs手动上传和下载命令使用,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

为什么80%的码农都做不了架构师?>>>   hot3.png

项目中目前使用的FastDFS做文件存储,但是最近项目并发量有点高,经常出现文件下载和上传时间较长的情况,这是需要排查是因为网络延迟、请求阻塞或者FastDFS的问题。

如何排查是否是FastDFS问题而不是网络延迟导致的,我们最好可以在部署FastDFS的服务器上手动执行上传和下载,因为FastDFS目前没有在维护导致这方面的资料比较少,所以记录下来方便有需要的朋友使用。

上传

fdfs_test /etc/fdfs/client.conf.sample upload ~/2.png

执行结果:

This is FastDFS client test program v5.09

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.

[2018-07-03 11:37:02] DEBUG - base_path=/data/fdfs/fastdfs_tracker, 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.20.13, port=23000
	server 2. group_name=, ip_addr=10.0.20.14, port=23000
	server 3. group_name=, ip_addr=10.0.20.15, port=23000

group_name=group1, ip_addr=10.0.20.15, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png
source ip address: 10.0.20.15
file timestamp=2018-07-03 11:37:02
file size=204254
file crc32=930688791
example file url: http://10.0.20.15/group1/M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105_big.png
source ip address: 10.0.20.15
file timestamp=2018-07-03 11:37:02
file size=204254
file crc32=930688791
example file url: http://10.0.20.15/group1/M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105_big.png

其中有两个需要注意的group_name和remote_filename,这个在我们后面的文件下载需要用到

group_name=group1, remote_filename=M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png

下载

fdfs_test /etc/fdfs/client.conf.sample download group1 M00/02/32/CgAUD1s6716ATKtBAAMd3jd5Lxc105.png

downlad后面的两个参数就是上面上传返回的group_name和remote_filename

结果:

This is FastDFS client test program v5.09

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.

[2018-07-03 11:44:01] DEBUG - base_path=/data/fdfs/fastdfs_tracker, 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.20.13:23000
download file success, file size=204254, file save to CgAUD1s6716ATKtBAAMd3jd5Lxc105.png

root@VM010000020015 fdfs]# ls
CgAUD1s6716ATKtBAAMd3jd5Lxc105.png  client.conf.sample  storage.conf  storage_ids.conf.sample  tracker.conf

转载于:https://my.oschina.net/kipeng/blog/1839425

最后

以上就是拉长盼望为你收集整理的Fastdfs手动上传和下载命令使用的全部内容,希望文章能够帮你解决Fastdfs手动上传和下载命令使用所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(38)

评论列表共有 0 条评论

立即
投稿
返回
顶部