How to retrieve data from hbase using java?

Lariskayb
Lariskayb

Posted On: Feb 26, 2020

 

We can retrieve data from HBase using java using following steps:-

  1. Instantiating Configuration class: Configuration config_reference = HBaseConfiguration.create();
  2. Instantiating HTable class: HTable table_reference = new HTable(config, "table_name");
  3. Instantiating Get class:Get get_reference = new Get(Bytes.toBytes(" table_row"));
  4. Reading the data: Result result = table.get(get_reference);
  5. Reading values from Result class object:byte [] value = result.getValue(Bytes.toBytes("table_columnfamily"),Bytes.toBytes("table_column"));

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    HBase Interview Questions

    What is HBASE?

    The HBase is a Hadoop database which is used for real-time read writes the data of your large amount of data. It is a java based non-relational database which is distributed column-based database...

    HBase Interview Questions

    What is compaction in hbase?

    The Hbase is real-time read and writes access as well it stores big data. The compaction in HBase is combined all HFiles into large single Hfile. The maximum number of disk seeks to reduce. it is easy...

    HBase Interview Questions

    List some key components of Hbase?

    The main components of Hbase are:HMaster: it is used for assign region to region server in the Hadoop cluster for Manage and monitors the Hadoop cluster. It is used for table manipulation. Region...