In this post, we’ll take a look at the new HBase Browser App added in Hue 2.5.
If you want to learn how to create various tables in HBase, go look at episode 1!
Prerequisites before starting Hue:
-
Have Hue built or installed
-
Have HBase and Thrift Service 1 initiated (Thrift can be configured through Cloudera Manager or manually). Look at the HBase service configuration and check to see if the “Enable HBase Thrift Server Framed Transport” property is enabled. If it is, try unchecking it or set ‘thrift_transport=framed’ in the [hbase] section of the hue.ini.
-
Configure your list of HBase Clusters in hue.ini to point to your Thrift IP/Port
[hbase]
\# Comma-separated list of HBase Thrift servers for clusters in the format of '(name|host:port)'.
hbase_clusters=(Cluster|my-host1:9090),(Cluster2|localhost:9090)
\# Hard limit of rows or columns per row fetched before truncating.
\## truncate_limit = 500
In this video, we’re walking through two main features of this app. Let’s talk about HBase Browser!
SmartView
The smartview is the view that you land on when you first enter a table. On the left hand side are the row keys and hovering over a row reveals a list of controls on the right. Click a row to select it, and once selected you can perform batch operations, sort columns, or do any amount of standard database operations. To explore a row, simple scroll to the right. By scrolling, the row should continue to lazily-load cells until the end.
Adding Data
To initially populate the table, you can insert a new row or bulk upload CSV/TSV/etc. type data into your table.
On the right hand side of a row is a ‘+’ sign that lets you insert columns into your row
Mutating Data
To edit a cell, simply click to edit inline:
If you need more control or data about your cell, click “Full Editor” to edit.
In the full editor, you can view cell history or upload binary data to the cell. Binary data of certain MIME Types are detected, meaning you can view and edit images, PDFs, JSON, XML, and other types directly in your browser!
Hovering over a cell also reveals some more controls (such as the delete button or the timestamp). Click the title to select a few and do batch operations:
If you need some sample data to get started and explore, check out this howto create HBase table tutorial.
Smart Searchbar
The “Smart Searchbar” is a sophisticated tool that helps you zero-in on your data. The smart search supports a number of operations. The most basic ones include finding and scanning row keys. Here I am selecting two row keys with:
domain.100, domain.200
Submitting this query gives me the two rows I was looking for. If I want to fetch rows after one of these, I have to do a scan. This is as easy as writing a ‘+’ followed by the number of rows you want to fetch. Typing in:
domain.100, domain.200 +5
Fetches domain.100 and domain.200 followed by the next 5 rows. If you’re ever confused about your results, you can look down below and the query bar and also click in to edit your query.
The Smart Search also supports column filtering. On any row, I can specify the specific columns or families I want to retrieve. With:
domain.100[column_family:]
I can select a bare family, or mix columns from different families like so:
domain.100[family1:, family2:, family3:column_a]
Doing this will restrict my results from one row key to the columns I specified. If you want to restrict column families only, the same effect can be achieved with the filters on the right. Just click to toggle a filter.
Finally, let’s try some more complex column filters. I can query for bare columns:
domain.100[column_a]
This will multiply my query over all column families. I can also do prefixes and scans:
domain.100[family: prefix* +3]
This will fetch me all columns that start with prefix* limited to 3 results. Finally, I can filter on range:
domain.100[family: column1 to column100]
This will fetch me all columns in ‘family:’ that are lexicographically >= column1 but <= column100. The first column (‘column1’) must be a valid column, but the second can just be any string for comparison.
The Smart Search also supports prefix filtering on rows. To select a prefixed row, simply type the row key followed by a star *. The prefix should be highlighted like any other searchbar keyword. A prefix scan is performed exactly like a regular scan, but with a prefixed row.
domain.10* +10
Finally, as a new feature, you can also take full advantage of the HBase filtering language, by typing your filter string between curly braces. HBase Browser autocompletes your filters for you so you don’t have to look them up every time. You can apply filters to rows or scans.
domain.1000 {ColumnPrefixFilter('100-') AND ColumnCountGetFilter(3)}
This post only covers a few basic features of the Smart Search. You can take advantage of the full querying language by referring to the help menu when using the app. These include column prefix, bare columns, column range, etc. Remember that if you ever need help with the searchbar, you can use the help menu that pops up while typing, which will suggest next steps to complete your query.
Et voila!
Feel free to try the app at gethue.com. Let us know what you think on the Hue user group!
Look forward to more features including Thrift 2 support, kerberos security and bulk data upload.