Skip to content

Instantly share code, notes, and snippets.

@shawnhermans
Last active December 14, 2015 22:18
Show Gist options
  • Save shawnhermans/5156834 to your computer and use it in GitHub Desktop.
Save shawnhermans/5156834 to your computer and use it in GitHub Desktop.
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
class PutExample {
public static void main(String[] args) throws IOException {
Configuration conf = HBaseConfiguration.create();
HTable table = new HTable(conf, "testtable");
Put put = new Put(Bytes.toBytes("row1"));
put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), Bytes.toBytes("val1"));
put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual2"), Bytes.toBytes("val2"));
table.put(put);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment