免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2989 | 回复: 1
打印 上一主题 下一主题

[FastDFS] 求助,fastdfs怎么通过JAVA查看 storge总容量和已使用, [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-12-19 15:40 |只看该作者 |倒序浏览
求助,fastdfs怎么通过JAVA查看 storge总容量和已使用,算出 used 百分比。。。。。
找了半天 没有类似的文档

论坛徽章:
1
寅虎
日期:2014-12-04 11:16:20
2 [报告]
发表于 2014-12-22 10:48 |只看该作者
本帖最后由 q288288 于 2014-12-22 10:56 编辑
  1. package org.csource.fastdfs;


  2. public class StructGroupStat
  3.    extends StructBase
  4. {
  5.    protected static final int FIELD_INDEX_GROUP_NAME = 0;
  6.    
  7.    protected static final int FIELD_INDEX_FREE_MB = 1;
  8.    
  9.    protected static final int FIELD_INDEX_TRUNK_FREE_MB = 2;
  10.    
  11.    protected static final int FIELD_INDEX_STORAGE_COUNT = 3;
  12.    
  13.    protected static final int FIELD_INDEX_STORAGE_PORT = 4;
  14.    
  15.    protected static final int FIELD_INDEX_STORAGE_HTTP_PORT = 5;
  16.    
  17.    protected static final int FIELD_INDEX_ACTIVE_COUNT = 6;
  18.    
  19.    protected static final int FIELD_INDEX_CURRENT_WRITE_SERVER = 7;
  20.    
  21.    protected static final int FIELD_INDEX_STORE_PATH_COUNT = 8;
  22.    
  23.    protected static final int FIELD_INDEX_SUBDIR_COUNT_PER_PATH = 9;
  24.    
  25.    protected static final int FIELD_INDEX_CURRENT_TRUNK_FILE_ID = 10;
  26.    
  27.    protected static int fieldsTotalSize;
  28.    
  29.    protected static StructBase.FieldInfo[] fieldsArray = new StructBase.FieldInfo[11];
  30.    protected String groupName;
  31.    protected long freeMB;
  32.    
  33.    static { int offset = 0;
  34.      fieldsArray[0] = new StructBase.FieldInfo("groupName", offset, 17);
  35.      offset += 17;
  36.      
  37.      fieldsArray[1] = new StructBase.FieldInfo("freeMB", offset, 8);
  38.      offset += 8;
  39.      
  40.      fieldsArray[2] = new StructBase.FieldInfo("trunkFreeMB", offset, 8);
  41.      offset += 8;
  42.      
  43.      fieldsArray[3] = new StructBase.FieldInfo("storageCount", offset, 8);
  44.      offset += 8;
  45.      
  46.      fieldsArray[4] = new StructBase.FieldInfo("storagePort", offset, 8);
  47.      offset += 8;
  48.      
  49.      fieldsArray[5] = new StructBase.FieldInfo("storageHttpPort", offset, 8);
  50.      offset += 8;
  51.      
  52.      fieldsArray[6] = new StructBase.FieldInfo("activeCount", offset, 8);
  53.      offset += 8;
  54.      
  55.      fieldsArray[7] = new StructBase.FieldInfo("currentWriteServer", offset, 8);
  56.      offset += 8;
  57.      
  58.      fieldsArray[8] = new StructBase.FieldInfo("storePathCount", offset, 8);
  59.      offset += 8;
  60.      
  61.      fieldsArray[9] = new StructBase.FieldInfo("subdirCountPerPath", offset, 8);
  62.      offset += 8;
  63.      
  64.      fieldsArray[10] = new StructBase.FieldInfo("currentTrunkFileId", offset, 8);
  65.      offset += 8;
  66.      
  67.      fieldsTotalSize = offset;
  68.    }
  69.    

  70.    protected long trunkFreeMB;
  71.    
  72.    protected int storageCount;
  73.    
  74.    protected int storagePort;
  75.    
  76.    protected int storageHttpPort;
  77.    
  78.    protected int activeCount;
  79.    
  80.    protected int currentWriteServer;
  81.    
  82.    protected int storePathCount;
  83.    protected int subdirCountPerPath;
  84.    protected int currentTrunkFileId;
  85.    public String getGroupName()
  86.    {
  87.      return this.groupName;
  88.    }
  89.    




  90.    public long getFreeMB()
  91.    {
  92.      return this.freeMB;
  93.    }
  94.    




  95.    public long getTrunkFreeMB()
  96.    {
  97.      return this.trunkFreeMB;
  98.    }
  99.    




  100.    public int getStorageCount()
  101.    {
  102.      return this.storageCount;
  103.    }
  104.    




  105.    public int getActiveCount()
  106.    {
  107.      return this.activeCount;
  108.    }
  109.    




  110.    public int getStoragePort()
  111.    {
  112.      return this.storagePort;
  113.    }
  114.    




  115.    public int getStorageHttpPort()
  116.    {
  117.      return this.storageHttpPort;
  118.    }
  119.    




  120.    public int getCurrentWriteServer()
  121.    {
  122.      return this.currentWriteServer;
  123.    }
  124.    




  125.    public int getStorePathCount()
  126.    {
  127.      return this.storePathCount;
  128.    }
  129.    




  130.    public int getSubdirCountPerPath()
  131.    {
  132.      return this.subdirCountPerPath;
  133.    }
  134.    




  135.    public int getCurrentTrunkFileId()
  136.    {
  137.      return this.currentTrunkFileId;
  138.    }
  139.    





  140.    public void setFields(byte[] bs, int offset)
  141.    {
  142.      this.groupName = stringValue(bs, offset, fieldsArray[0]);
  143.      this.freeMB = longValue(bs, offset, fieldsArray[1]);
  144.      this.trunkFreeMB = longValue(bs, offset, fieldsArray[2]);
  145.      this.storageCount = intValue(bs, offset, fieldsArray[3]);
  146.      this.storagePort = intValue(bs, offset, fieldsArray[4]);
  147.      this.storageHttpPort = intValue(bs, offset, fieldsArray[5]);
  148.      this.activeCount = intValue(bs, offset, fieldsArray[6]);
  149.      this.currentWriteServer = intValue(bs, offset, fieldsArray[7]);
  150.      this.storePathCount = intValue(bs, offset, fieldsArray[8]);
  151.      this.subdirCountPerPath = intValue(bs, offset, fieldsArray[9]);
  152.      this.currentTrunkFileId = intValue(bs, offset, fieldsArray[10]);
  153.    }
  154.    




  155.    public static int getFieldsTotalSize()
  156.    {
  157.      return fieldsTotalSize;
  158.    }
  159.    
  160.    public StructGroupStat() {}
  161. }
复制代码
上面是系统自带类,里面的freeMB参数可能对您有用
这是php的FastDFS参数说明你可以参考一下:luhuang.sinaapp.com/fastdfs-fastdfstrackerlistgroups/
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP