[java]代码库
HTable table = new HTable(hbaseConfig, tableName);
table.setAutoFlush(autoFlush);
List<Put> lp = new ArrayList<Put>();
int count = 10000;
byte[] buffer = new byte[1024];
Random r = new Random();
for (int i = 1; i <= count; ++i) {
Put p = new Put(String.format(“row%09d”,i).getBytes());
r.nextBytes(buffer);
p.add(“f1″.getBytes(), null, buffer);
p.add(“f2″.getBytes(), null, buffer);
p.add(“f3″.getBytes(), null, buffer);
p.add(“f4″.getBytes(), null, buffer);
p.setWriteToWAL(wal);
lp.add(p);
if(i%1000==0){
table.put(lp);
lp.clear();
}
}