fastdfs测试上传

fastdfs测试上传

1.修改配置文件

​ 进入到/etc/fdfs

​ 下载[root@localhost fdfs]# sz client.conf.sample

base_path=/home/yuqing/fastdfs

修改为:base_path=/opt/fastdfs/client

tracker_server=192.168.179.129:22122

2.启动进程,并查看

[root@localhost fdfs]# ps -ef | grep fdfs
root 60471 1 2 20:09 ? 00:00:18 fdfs_storaged /etc/fdfs/storage.conf
root 60592 1 0 20:17 ? 00:00:03 fdfs_trackerd /etc/fdfs/tracker.conf
root 60705 11078 0 20:23 pts/1 00:00:00 grep --color=auto fdfs
[root@localhost fdfs]#

3.创建测试文件

[root@localhost ~]# vim aa.txt

4.新建文件夹

[root@localhost fastdfs]# mkdir /opt/fastdfs/client

4.测试

Usage: fdfs_test <config_file>
operation: upload, download, getmeta, setmeta, delete and query_servers

5.上传(必须在你创建的文件的文件夹里面upload)

[root@localhost ~]# fdfs_test /etc/fdfs/client.conf upload

[root@localhost fastdfs]# fdfs_test /etc/fdfs/client.conf upload aa.txt

6.提示成功

This is FastDFS client test program v5.11

Copyright © 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.

[2020-12-05 20:30:53] DEBUG - base_path=/opt/fastdfs/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=192.168.179.129, port=23000

group_name=group1, ip_addr=192.168.179.129, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKizgV_LfX2AetouAAAAG3ysYXc466.txt
source ip address: 192.168.179.129
file timestamp=2020-12-05 20:30:53
file size=27
file crc32=2091671927
example file url: http://192.168.179.129/group1/M00/00/00/wKizgV_LfX2AetouAAAAG3ysYXc466.txt
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKizgV_LfX2AetouAAAAG3ysYXc466_big.txt
source ip address: 192.168.179.129
file timestamp=2020-12-05 20:30:53
file size=27
file crc32=2091671927
example file url: http://192.168.179.129/group1/M00/00/00/wKizgV_LfX2AetouAAAAG3ysYXc466_big.txt

6.查看上传的位置 和文件(opt/fastdfs/storage/files/data/00/00)

[root@localhost 00]# ll
total 16
-rw-r–r--. 1 root root 27 Dec 5 20:30 wKizgV_LfX2AetouAAAAG3ysYXc466_big.txt
-rw-r–r--. 1 root root 49 Dec 5 20:30 wKizgV_LfX2AetouAAAAG3ysYXc466_big.txt-m
-rw-r–r--. 1 root root 27 Dec 5 20:30 wKizgV_LfX2AetouAAAAG3ysYXc466.txt
-rw-r–r--. 1 root root 49 Dec 5 20:30 wKizgV_LfX2AetouAAAAG3ysYXc466.txt-m

M00------>opt/fastdfs/storage/files/data

文本格式不能很好显示,请见谅(附件里有比较齐整的excel表格统计) 大小类型 传输类型 api方法 文件大小 花费时间 速率byte/ms 速率mb/s 缓存数组 次数 备注 大文件 下载 download_file(group_name, remote_filename, localFile) 1073741824(约1G) 28343ms 37883 36.12804413 无 1 下载 download_file(group_name, remote_filename , downloadStream) 1073741824(约1G) 29195ms 36778 35.07423401 0 1 fastDFS的DownloadStream,FileOutputStream 下载 download_file(group_name, remote_filename , downloadStream) 1073741824(约1G) 24352ms 44092 42.04940796 2K 1 fastDFS的DowloadStream,BufferedOutputStream 下载 download_file(group_name, remote_filename , DownloadCallback) 1073741824(约1G) 24831ms 43241 41.23783112 2K 1 实现DownloadCallback,BufferedOutputStream 下载 download_file(group_name, remote_filename , DownloadCallback) 1073741824(约1G) 25922ms 41422 39.50309753 8K 1 实现DownloadCallback,BufferedOutputStream 普通文件 下载 download_file(group_name, remote_filename, localFile) 59113472(约56M) 382ms 154747 147.5782394 无 1 下载 download_file(group_name, remote_filename , downloadStream) 59113472(约57M) 369ms 160199 152.7776718 0 1 fastDFS的DownloadStream,FileOutputStream 下载 download_file(group_name, remote_filename , downloadStream) 59113472(约58M) 499ms 118702 113.2030487 2K 1 fastDFS的DowloadStream,BufferedOutputStream 下载 download_file(group_name, remote_filename , DownloadCallback) 59113472(约59M) 592ms 99853 95.22724152 2K 1 实现DownloadCallback,BufferedOutputStream 下载建议:100M内数据使用fastDFS提供的DownloadStream;大于1G的数据,使用BufferedOutputStream和DowloadStream
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值