HBase Interview Questions

HBase Interview Questions

Q. Explain what is Hbase?

Hbase is a column-oriented database management system which runs on top of HDFS (Hadoop Distribute File System). Hbase is not a relational data store, and it does not support structured query language like SQL.

In Hbase, a master node regulates the cluster and region servers to store portions of the tables and operates the work on the data.

Q. Explain why to use Hbase?

High capacity storage system

Distributed design to cater large tables

Column-Oriented Stores

Horizontally Scalable

High performance & Availability

Base goal of Hbase is millions of columns, thousands of versions and billions of rows

Unlike HDFS (Hadoop Distribute File System), it supports random real time CRUD operations

Q. Mention what are the key components of Hbase?

Zookeeper: It does the co-ordination work between client and Hbase Maser

Hbase Master: Hbase Master monitors the Region Server

RegionServer: RegionServer monitors the Region

Region: It contains in memory data store(MemStore) and Hfile.

Catalog Tables: Catalog tables consist of ROOT and META

Q. Explain what does Hbase consists of?

Hbase consists of a set of tables

And each table contains rows and columns like traditional database

Each table must contain an element defined as a Primary Key

Hbase column denotes an attribute of an object

Q. Mention how many operational commands in Hbase?

Operational command in Hbases is about five types

  • Get
  • Put
  • Delete
  • Scan
  • Increment

Q. Explain what is WAL and Hlog in Hbase?

WAL (Write Ahead Log) is similar to MySQL BIN log; it records all the changes occur in data. It is a standard sequence file by Hadoop and it stores HLogkey’s.  These keys consist of a sequential number as well as actual data and are used to replay not yet persisted data after a server crash. So, in cash of server failure WAL work as a life-line and retrieves the lost data’s.

Q. When you should use Hbase?

Data size is huge: When you have tons and millions of records to operate

Complete Redesign: When you are moving RDBMS to Hbase, you consider it as a complete re-design then mere just changing the ports

SQL-Less commands: You have several features like transactions; inner joins, typed columns, etc.

Infrastructure Investment: You need to have enough cluster for Hbase to be really useful

Q. In Hbase what is column families?

Column families comprise the basic unit of physical storage in Hbase to which features like compressions are applied.

Q. Explain what is the row key?

Row key is defined by the application. As the combined key is pre-fixed by the rowkey, it enables the application to define the desired sort order. It also allows logical grouping of cells and make sure that all cells with the same rowkey are co-located on the same server.

Q. Explain deletion in Hbase? Mention what are the three types of tombstone markers in Hbase?

When you delete the cell in Hbase, the data is not actually deleted but a tombstone marker is set, making the deleted cells invisible.  Hbase deleted are actually removed during compactions.

Three types of tombstone markers are there:

Version delete marker: For deletion, it marks a single version of a column

Column delete marker: For deletion, it marks all the versions of a column

Family delete marker: For deletion, it marks of all column for a column family

Q. Explain how does Hbase actually delete a row?

In Hbase, whatever you write will be stored from RAM to disk, these disk writes are immutable barring compaction. During deletion process in Hbase, major compaction process delete marker while minor compactions don’t. In normal deletes, it results in a delete tombstone marker- these delete data they represent are removed during compaction.

Also, if you delete data and add more data, but with an earlier timestamp than the tombstone timestamp, further Getsmay be masked by the delete/tombstone marker and hence you will not receive the inserted value until after the major compaction.

Q. Explain what happens if you alter the block size of a column family on an already occupied database?

When you alter the block size of the column family, the new data occupies the new block size while the old data remains within the old block size. During data compaction, old data will take the new block size.  New files as they are flushed, have a new block size whereas existing data will continue to be read correctly. All data should be transformed to the new block size, after the next major compaction.

Q. Mention the difference between Hbase and Relational Database?


It is schema-less
It is a column-oriented data store
It is used to store de-normalized data
It contains sparsely populated tables
Automated partitioning is done in Hbase

Relational Database

It is a schema based database
It is a row-oriented data store
It is used to store normalized data
It contains thin tables
There is no such provision or built-in support for partitioning

Q. What is the history of HBase?

2006: BigTable paper published by Google.
2006 (end of year): HBase development starts.
2008: HBase becomes Hadoop sub-project.
2010: HBase becomes Apache top-level project.

Q. What is Apache HBase?

Apache Hbase is one the sub-project of  Apache Hadoop, which was designed for NoSql database(Hadoop Database),bigdata store and a distributed, scalable.Use Apache HBase when you need random, realtime read/write access to your Big Data.A table which contain billions of rows X millions of columns -atop clusters of commodity hardware. Apache HBase is an open-source, distributed, versioned, non-relational database modeled after Google’s Bigtable. Apache HBase provides Bigtable-like capabilities  run on top of Hadoop and HDFS.

Q. What is NoSql?

Apache HBase is a type of “NoSQL” database. “NoSQL” is a general term meaning that the database isn’t an RDBMS which supports SQL as its primary access language, but there are many types of NoSQL databases: BerkeleyDB is an example of a local NoSQL database, whereas HBase is very much a distributed database. Technically speaking, HBase is really more a “Data Store” than “Data Base” because it lacks many of the features you find in an RDBMS, such as typed columns, secondary indexes, triggers, and advanced query languages, etc.

Q. What are the main features of Apache HBase?

Apache HBase has many features which supports both linear and modular scaling,HBase tables are distributed on the cluster via regions, and regions are automatically split and re-distributed as your data grows(Automatic sharding). HBase supports a Block Cache and Bloom Filters for high volume query optimization (Block Cache and Bloom Filters.

Q. When should we use Hbase?

1) we should have milions or billions of rows and columns in table at that point only we have use Hbase otherwise better to go RDBMS(we have use thousand of rows and columns)
2) In RDBMS should runs on single database server but in hbase is distributed and scalable and also run on commodity hardware.
3) typed columns, secondary indexes, transactions, advanced query languages, etc these features provided by Hbase,not by RDBMS.

Q. What is the difference between HDFS/Hadoop and HBase?

HDFS doesn’t provides fast lookup records in a file,IN Hbase provides fast lookup records for large table.

Q. Is there any difference between HBase datamodel and RDBMS datamodel?

In Hbase,data is stored as a table(have rows and columns) similar to RDBMS but this is not a helpful analogy. Instead, it can be helpful to think of an HBase table as a multi-dimensional map.

Q. What are key terms are used for designing of HBase datamodel?

1) table(Hbase table consists of rows)
2) row(Row in hbase which contains row key and one or more columns with value associated with them)
3) column(A column in HBase consists of a column family and a column qualifier, which are delimited by a : (colon) character)
4) column family(having set of columns and their values,the column families should be considered carefully during schema design)
5) column qualifier(A column qualifier is added to a column family to provide the index for a given piece of data)
6) cell(A cell is a combination of row, column family, and column qualifier, and contains a value and a timestamp, which represents the value’s version)
7) timestamp( represents the time on the RegionServer when the data was written, but you can specify a different timestamp value when you put data into the cell)

Q. What are datamodel operations in HBase?

1) Get(returns attributes for a specified row,Gets are executed via HTable.get)
2) put(Put either adds new rows to a table (if the key is new) or can update existing rows (if the key already exists). Puts are executed via HTable.put (writeBuffer) or HTable.batch (non-writeBuffer))
3) scan(Scan allow iteration over multiple rows for specified attributes)
4) Delete(Delete removes a row from a table. Deletes are executed via HTable.delete)

HBase does not modify data in place, and so deletes are handled by creating new markers called tombstones. These tombstones, along with the dead values, are cleaned up on major compaction.

Q. How should filters are useful in Apache HBase?

Filters In Hbase Shell,Filter Language was introduced in APache HBase 0.92. It allows you to perform server-side filtering when accessing HBase over Thrift or in the HBase shell.

Q. How many filters are available in Apache HBase?

Total we have 18 filters are support to hbase.They are:

  1. ColumnPrefixFilter
  2. TimestampsFilter
  3. PageFilter
  4. MultipleColumnPrefixFilter
  5. FamilyFilter
  6. ColumnPaginationFilter
  7. SingleColumnValueFilter
  8. RowFilter
  9. QualifierFilter
  10. ColumnRangeFilter
  11. ValueFilter
  12. PrefixFilter
  13. SingleColumnValueExcludeFilter
  14. ColumnCountGetFilter
  15. InclusiveStopFilter
  16. DependentColumnFilter
  17. FirstKeyOnlyFilter
  18. KeyOnlyFilter

Q. How can we use MapReduce with HBase?

Apache MapReduce is a software framework used to analyze large amounts of data, and is the framework used most often with Apache Hadoop. HBase can be used as a data source, TableInputFormat, and data sink, TableOutputFormat or MultiTableOutputFormat, for MapReduce jobs. Writing MapReduce jobs that read or write HBase, it is advisable to subclass TableMapper and/or TableReducer.

Q. How do we back up my HBase cluster? 

There are two broad strategies for performing HBase backups: backing up with a full cluster shutdown, and backing up on a live cluster. Each approach has pros and cons.

1) Full Shutdown Backup: Some environments can tolerate a periodic full shutdown of their HBase cluster, for example if it is being used a back-end analytic capacity and not serving front-end web-pages. The benefits are that the NameNode/Master are RegionServers are down, so there is no chance of missing any in-flight changes to either StoreFiles or metadata. The obvious con is that the cluster is down.

2) Live Cluster Backup:
live clusterbackup-copytable:copy table utility could either be used to copy data from one table to another on the same cluster, or to copy data to another table on another cluster.
live cluster backup-export:export approach dumps the content of a table to HDFS on the same cluster.

Q. Does HBase support SQL?

Not really. SQL-ish support for HBase via Hive is in development, however Hive is based on MapReduce which is not generally suitable for low-latency requests.By using Apache Phoenix  can retrieve data from hbase by using sql queries.

0 Responses on HBase Interview Questions"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.