HBase中删除一条数据的方法是通过调用Delete类的实例来实现。删除数据的步骤如下:
Delete delete = new Delete(Bytes.toBytes("rowkey"));
delete.setTimestamp(timestamp);
delete.addColumn(Bytes.toBytes("columnFamily"), Bytes.toBytes("columnQualifier"));
delete.addFamily(Bytes.toBytes("columnFamily"));
delete.setTimeRange(minTimestamp, maxTimestamp);
Table table = connection.getTable(TableName.valueOf("table"));
table.delete(delete);
注意:在删除数据之前,需要确保HBase表已经存在,并且已经建立连接(Connection)和表(Table)的实例。