public class myHbase {
private static Configuration conf= null;
static {
conf=HBaseConfiguration
}
/**
* column familys add column <
* @param tableName
* @param familys
* @throws Exception
*/
public void createTable(String tableName
HBaseAdmin admin = new HBaseAdmin(conf)
if(!admin
HTableDescriptor desc = new HTableDescriptor(tableName)
for (int i =
desc
}
admin
}else{
System
};
}
/**
* @param tableName
* @param rowKey
* @param family
* @param qualifier
* @param value
* @throws Exception
*/
public void putData(String tableName
String qualifier
HTable ht = new HTable(conf
Put put = new Put(Bytes
put
ht
}
public static void main(String [] agrs) throws Exception{
myHbase h= new myHbase()
String [] familys = {
h
h
}
}
運行java應用程序
hbase(main)
ROW COLUMN+CELL
row column=family
alue=value
hbase(main)
COLUMN CELL
family
me
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26356.html