最近看了看fastdfs,想测试一下各分组的存储。但是仔细一看,却没有现成的按group上传文件的工具。自己动手,丰衣足食了。


FastDFS/client/Makefile.in ALL_PRGS 变量加上 fdfs_upload_file_with_group          
cp fdfs_upload_file.c fdfs_upload_file_with_group.c
vim fdfs_upload_file_with_group.c
33 行改成 printf("Usage: %s \n", argv[0]);
54 行到 66 行改成这样:
        strcpy(group_name, argv[3]);
        if ((result=tracker_query_storage_store_with_group(pTrackerServer, \
                              group_name, &storageServer, &store_path_index)) != 0)
        {
                fdfs_client_destroy();
                fprintf(stderr, "tracker_query_storage fail, " \
                        "error no: %d, error info: %s\n", \
                        result, STRERROR(result));
                return result;
        }
        local_filename = argv[2];
        result = storage_upload_by_filename1(pTrackerServer, \
原本的存储位置: &storageServer 是由 tracker_query_storage_store 方法得到的。这里改成 tracker_query_storage_store_with_group
fdfs 安装完成之后就可以在 /usr/local/fdfs/bin 下看到 fdfs_upload_file_with_group u know how to use it :P