【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
项目中目前使用的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
来源:oschina
链接:https://my.oschina.net/u/2365112/blog/1839425