How to list all row keys in an hbase table?

How do I list all row keys in an hbase table?

I need to do this using PHP with a REST interface.

+3
source share
4 answers

If you specify all the keys in the HBase table, you are using the wrong tool. HBase is designed for large data systems where it is not practical to list all keys.

What could be more reasonable is to start with the given key and list the next N keys (for values ​​of N less than 10K). There are good Java interfaces for doing this type of thing with validation - setting a start key and / or end key.

Most HBase features are displayed through the Thrift interface. I would suggest looking there

+5
source
+4

I don't know what the REST interface looks like, but you probably want to filter out some data on the client side to avoid big RPC responses. You can do this by adding server filters to your scan:

Scan s = new Scan();
FilterList fl = new FilterList();
// returns first instance of a row, then skip to next row
fl.addFilter(new FirstKeyOnlyFilter());
// only return the Key, don't return the value
fl.addFilter(new KeyOnlyFilter());
s.setFilter(fl);

HTable myTable;
ResultScanner rs = myTable.getScanner(s);
Result row = rs.next();
while (row != null) ...

http://svn.apache.org/repos/asf/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/filter/

+4
source

It...

http://localhost:8080/tablename/*/columnfamily:columnid 

... will return all the values ​​in your table relative to this column in this table, such as applying a column filter in the scanner.

Also, if you are looking for multiple columns, separate them with a comma.

So: /tablename/*/columnfamily:columnid,columnfamily:columnid2

+3
source

All Articles