fastDFS在虚拟机里面装好并测试通过,但是用javaAPI的时候报SocketTimeoutException: connect timed out异常

爱情过夜 2016-03-10 05:57:59
[root@localhost conf]# /usr/bin/fdfs_test /etc/fdfs/client.conf upload anti-steal.jpg
This is FastDFS client test program v5.08

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-03-10 01:20:23] DEBUG - base_path=/export/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.80.132, port=23000

group_name=group1, ip_addr=192.168.80.132, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKhQhFbhPFeAR8vmAABdrZgsqUU060.jpg
source ip address: 192.168.80.132
file timestamp=2016-03-10 01:20:23
file size=23981
file crc32=2553063749
example file url: http://192.168.80.132/group1/M00/00/00/wKhQhFbhPFeAR8vmAABdrZgsqUU060.jpg
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKhQhFbhPFeAR8vmAABdrZgsqUU060_big.jpg
source ip address: 192.168.80.132
file timestamp=2016-03-10 01:20:23
file size=23981
file crc32=2553063749
example file url: http://192.168.80.132/group1/M00/00/00/wKhQhFbhPFeAR8vmAABdrZgsqUU060_big.jpg
上面是我在虚拟机里面安装好fastDFS和nginx后测试结果,在本地浏览器里面能看到上传的这张图片。
但是用javaAPI的时候报SocketTimeoutException: connect timed out异常,代码:
ClientGlobal.init("D:\\study_taotao\\work_space\\taotao-manager\\taotao-manager-web\\src\\main\\resources\\resource\\client.conf");
TrackerClient trackerClient = new TrackerClient();
TrackerServer trackerServer = trackerClient.getConnection();
StorageServer storageServer=null;
StorageClient storageClient = new StorageClient(trackerServer, storageServer);
String[] upload_file = storageClient.upload_file("C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg","jpg", null);
for (String string : upload_file) {
System.out.println(string);
}


我有一个地方不懂,就是在安装fastDFS的时候,tracker.conf、storage.conf、client.conf里面都有http.server_port节点,我怀疑是这个我配置的有问题,我都是配置成nginx的监听端口。
...全文
676 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
俺来啦 2016-09-08
  • 打赏
  • 举报
回复
上传文件不稳定可能是啥原因,时而成时而连接不上
jsflzhong 2016-06-12
  • 打赏
  • 举报
回复
这个问题已经解决,请见我的博客:http://blog.csdn.net/jsflzhong/article/details/51647481
MichaelW666 2016-05-03
  • 打赏
  • 举报
回复
楼主问题解决了吗?

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧