创建表名和列族名
create 't1','cf'
初始化counter为1 或 让counter+1
incr 't1','row1','cf:no',1
获取counter
get 't1','row1','cf:no'
获取counter
get_counter 't1','row1','cf:no'
@Test public void testCounter() throws Exception{ Table table = conn.getTable(TableName.valueOf("t1")); long counter = table.incrementColumnValue(Bytes.toBytes("row1"), Bytes.toBytes("cf"), Bytes.toBytes("no"), 1); System.out.println(counter); table.close(); }