Forum

This topic contains 0 replies, has 1 voice, and was last updated by  Avikumar 2 years, 5 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1276 Reply

    Avikumar
    Participant

    Existence of Table using HBase Shell:

    hbase(main):024:0> exists ’emp’
    Table emp does exist

    0 row(s) in 0.0750 seconds

    HBase – Drop a Table:-

    Dropping a Table using HBase Shell
    Using the drop command, you can delete a table. Before dropping a table, you have to disable it.

    hbase(main):018:0> disable ’emp’
    0 row(s) in 1.4580 seconds

    hbase(main):019:0> drop ’emp’
    0 row(s) in 0.3060 seconds
    Verify whether the table is deleted using the exists command.

    hbase(main):020:07gt; exists ’emp’
    Table emp does not exist
    0 row(s) in 0.0730 seconds
    drop_all
    This command is used to drop the tables matching the “regex” given in the command. Its syntax is as follows:

    hbase> drop_all ‘t.*’

    Now you can delete all of them using the drop_all command as given below.

    hbase(main):018:0> drop_all ‘raj.*’

    Deleting a Table Using Java API
    You can delete a table using the deleteTable() method in the HBaseAdmin class. Follow the steps given below to delete a table using java API.

    Step 1
    Instantiate the HBaseAdmin class.

    // creating a configuration object
    Configuration conf = HBaseConfiguration.create();

    // Creating HBaseAdmin object
    HBaseAdmin admin = new HBaseAdmin(conf);
    Step 2
    Disable the table using the disableTable() method of the HBaseAdmin class.

    admin.disableTable(“emp1”);
    Step 3
    Now delete the table using the deleteTable() method of the HBaseAdmin class.

    admin.deleteTable(“emp12”);

    HBase – Shutting Down:-
    exit
    You exit the shell by typing the exit command.

    hbase(main):021:0> exit

    Stopping HBase:
    To stop HBase, browse to the HBase home folder and type the following command.

    ./bin/stop-hbase.sh

    Stopping HBase Using Java API
    You can shut down the HBase using the shutdown() method of the HBaseAdmin class. Follow the steps given below to shut down HBase:

    admin.shutdown();

    HBase – Client API:
    Class HBase Configuration:
    Adds HBase configuration files to a Configuration. This class belongs to the org.apache.hadoop.hbase package.

    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.

    Class Put
    This class is used to perform Put operations for a single row. It belongs to the org.apache.hadoop.hbase.client package.

Viewing 1 post (of 1 total)
Reply To: HBase – Exists
Your information:




cf22

Your Name (required)

Your Email (required)

Subject

Phone No

Your Message

Cart

  • No products in the cart.