如何列出hbase表中的所有行键?

hba*_*ser 23 hbase

任何人都可以告诉我,如何列出hbase表中的所有行键?

Hai*_*mei 23

HBase shell可用于列出所有行键:

count 'table_name', { INTERVAL => 1 }
Run Code Online (Sandbox Code Playgroud)


Gel*_*eli 13

这应该快得多(FirstKeyOnlyFilter在服务器上运行并在将结果发送到客户端之前删除所有列数据):

Configuration conf = HBaseConfiguration.create();
HTable table = new HTable(conf, tableName.getBytes());
System.out.println("scanning full table:");
Scan scan = new Scan();
scan.setFilter(new FirstKeyOnlyFilter());
ResultScanner scanner = table.getScanner(scan);
for (Result rr : scanner) {
  byte[] key == rr.getRow();
  ...
}
Run Code Online (Sandbox Code Playgroud)


Dav*_*vid 5

Configuration conf = HBaseConfiguration.create();
HTable table = new HTable(conf, tableName.getBytes());

System.out.println("scanning full table:");
ResultScanner scanner = table.getScanner(new Scan());
for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
  byte[] key == rr.getRow();
  ...
}
Run Code Online (Sandbox Code Playgroud)