HBase – Shutting Down

  • Post author:
  • Post category:HBase
  • Post comments:1 Comment
Exit

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:

Step 1

Instantiate the HbaseAdmin class.

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

// Instantiating HBaseAdmin object
HBaseAdmin admin = new HBaseAdmin(conf);

Step 2

Shut down the HBase using the shutdown() method of the HBaseAdmin class.

admin.shutdown();

Given below is the program to stop the HBase.

import java.io.IOException;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class ShutDownHbase{

   public static void main(String args[])throws IOException {

      // Instantiating configuration class
      Configuration conf = HBaseConfiguration.create();

      // Instantiating HBaseAdmin class
      HBaseAdmin admin = new HBaseAdmin(conf);

      // Shutting down HBase
      System.out.println("Shutting down hbase");
      admin.shutdown();
   }
}

Compile and execute the above program as shown below.

$javac ShutDownHbase.java
$java ShutDownHbase

The following should be the output:

Shutting down hbase

Next Topic:-Click Here

This Post Has One Comment

Leave a Reply