Es-hbase-hbase-exists

提供:Dev Guides
移動先:案内検索

HBase-存在

存在するタブラの中央にあるタブラの存在を確認します。 El siguiente ejemplo muestracómoutilizar este comando。

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

0 row(s) in 0.0750 seconds

==================================================================

hbase(main):015:0> exists 'student'
Table student does not exist

0 row(s) in 0.0480 seconds

JavaのAPIを使用したタブラの実在性の検証

HBaseユーティリティの存在を確認するためのタブの検証* tableExists()メトードデラ *H​​BaseAdmin クラス。 SBaseは、HBaseのタブラに存在する継続的なパラグラフの連続した指標です。

手順1

Instantiate the HBaseAdimn class

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

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

手順2

タブラの実在性を検証する* tableExists()*。

HBaseはJavaのAPIを使用して、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 TableExists
{

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

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

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

  //Verifying the existance of the table
   boolean bool = admin.tableExists("emp");
   System.out.println( bool);
   }
}

連続したプログラムの比較プログラム。

$javac TableExists.java
$java TableExists

Lo siguiente debe ser el producto:

true