2016-06-23 85 views

回答

0

作为Cloudera的文档中提到的MOB支撑

特征是透明的到客户端。

https://www.cloudera.com/documentation/enterprise/5-5-x/topics/admin_hbase_mob.html

这意味着,你可以得到存储MOB的内容相同的方法,从任何其他列。在Java中:

 String namespace = "nmsp"; 
     String tblName = "MOB_TEST"; 
     byte[] rowKey = "MOB_1".getBytes(); 
     byte[] columnFamily = "D".getBytes(); 
     byte[] qualifier = "MOB".getBytes(); 

     Get g = new Get(rowKey); 
     g.addColumn(columnFamily, qualifier); 

     Configuration cfg = HBaseConfiguration.create(); 
     Connection con = ConnectionFactory.createConnection(cfg); 
     Table t = con.getTable(TableName.valueOf(namespace, tblName)); 

     Result r = t.get(g); 
     byte[] mobContent = r.getValue(columnFamily, qualifier); 

     Path outPath = FileSystems.getDefault() 
       .getPath("C:/testBigFile_fromHBase.xml"); 
     Files.write(outPath, mobContent);