Package Api;import Org.apache.hadoop.conf.configuration;import org.apache.hadoop.hbase.HBaseConfiguration; Import Org.apache.hadoop.hbase.client.htable;import Org.apache.hadoop.hbase.client.put;import Org.apache.hadoop.hbase.util.bytes;import java.io.IOException; Public classPutexample { Public Static voidMain (string[] args) throws IOException {Configuration cfg=hbaseconfiguration.create (); Htable htable=NewHtable (CFG,"Xyj"); Put put=NewPut (Bytes.tobytes ("R3")); //Fam qulifier ValuePut.add (Bytes.tobytes ("CF1"), Bytes.tobytes ("Qual1"), Bytes.tobytes ("Val1")); Put.add (Bytes.tobytes ("CF1"), Bytes.tobytes ("Qual2"), Bytes.tobytes ("Val2")); Put.add (Bytes.tobytes ("CF1"), Bytes.tobytes ("Qual3"), Bytes.tobytes ("Val3")); Htable.put (Put); }}//hbase (Main):001:0> create ' xyj ', ' cf1 '//hbase (main):004:0> put ' xyj ', ' R1 ', ' cf1:q1 ', ' v1 '//0 Row (s) in 0.0160 seconds////hbase (main):005:0> put ' xyj ', ' R2 ', ' cf1:q2 ', ' v2 '//0 Row (s) in 0.0100 seconds////hbase (main):006:0> put ' xyj ', ' R2 ', ' cf1:q3 ', ' V3 '//0 Row (s) in 0.0160 seconds////hbase (Main):007:0> list ' Xyj '//TABLE //Xyj //1 row (s) in 0.1330 seconds//hbase (Main):009:0> scan ' Xyj '//ROW Column+cell //R1 column=cf1:q1, timestamp=1511597241994, VALUE=V1 //R2 column=cf1:q2, timestamp=1511597275233, Value=v2 //R2 column=cf1:q3, timestamp=1511597290730, Value=v3 //R3 Column=cf1:qual1, timestamp=1511597438929, Value=val1 //R3 Column=cf1:qual2, timestamp=1511597438929, Value=val2 //R3 Column=cf1:qual3, timestamp=1511597438929, Value=val3 //3 Row (s) in 0.0510 seconds
hbase-java-api001