用Python导出mogilefs中的文件

背景

mogilefs中的文件是分布式存储的,在磁盘上程序为**.fid这样的文件,公司考虑将图片迁移到阿里云的OSS,执行如下步骤将图片导出

工具

Python 2.7+

步骤

  1.  安装mogilefs 的python客户端
    pip install pymogile
  2. 运行附件中的脚本,如导入四川逍遥的图片
    python get_mogilefs_files.py -d images -t "172.18.56.2:7001,172.18.31.80:7001" -o '/root/images'
    参数说明: 

        -d 为mogilefs 中的domain,目前生产环境只有images和files两个domain ; 

         -t 为mogilefs中的trackers,可以是单个或者多个,用逗号分割; 

        -o 为需要将文件输出到的目录

278M图片,耗时40秒,速度大概为7M/s

代码地址:

https://github.com/kevinniu666/mogilefs-client-python.git

发布了20 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/lwlfox/article/details/99677784