Put, get and delete method

HBase has its own java client in core library. It covers pretty much everything. (Got connection as well). If you need a asynchronous client

The primary client interface to HBase is the HTable class in the org.apache.hadoop.hbase.client package. It provides the user with all the functionality needed to store and retrieve data from HBase as well as delete obsolete values and so on. Before looking at the various methods this class provides, let us address some general aspects of its usage.

All operations that mutate data are guaranteed to be atomic on a per-row basis. This affects all other concurrent readers and writers of that same row. In other words, it does not matter if another client or thread is reading from or writing to the same row: they either read a consistent last mutation, or may have to wait before being able to apply their change.

There are four main operations performed in HBase and they are:

  • Create
  • Read (Get and Scan)
  • Add (update)
  • Delete.

HBase has a Java Native API which provides programmatic access to Data Manipulation Language (DML).

Class HBase Configuration

Adds HBase configuration files to a Configuration. This class belongs to the org.apache.hadoop.hbase package.

Methods and description

static org.apache.hadoop.conf.Configuration create() – This method creates a Configuration with HBase resources.

Class HTable

HTable is an HBase internal class that represents an HBase table. It is an implementation of table that is used to communicate with a single HBase table. This class belongs to the org.apache.hadoop.hbase.client class.

Constructors
  • HTable()
  • HTable(TableName tableName, ClusterConnection connection, ExecutorService pool)

Using this constructor, you can create an object to access an HBase table.

Methods and description

  • void close() – Releases all the resources of the HTable.
  • void delete(Delete delete) – Deletes the specified cells/row.
  • boolean exists(Get get) – Using this method, you can test the existence of columns in the table, as specified by Get.
  • Result get(Get get) – Retrieves certain cells from a given row.
  • apache.hadoop.conf.Configuration getConfiguration() – Returns the Configuration object used by this instance.
  • TableName getName() – Returns the table name instance of this table.
  • HTableDescriptor getTableDescriptor() – Returns the table descriptor for this table.
  • byte[] getTableName() – Returns the name of this table.
  • void put(Put put) – Using this method, you can insert data into the table.

    Apply for HBase Certification

    https://www.vskills.in/certification/certified-hbase-professional

    Back to Tutorials

    Share this post
    [social_warfare]
    HBase API
    Scans Technique

    Get industry recognized certification – Contact us

    keyboard_arrow_up