在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ 大數(shù)據(jù)/ HBase Exists
HBase禁用表
HBase創(chuàng)建表
HBase客戶端API
HBase安裝
HBase表描述和修改
HBase Admin API
HBase掃描
HBase創(chuàng)建數(shù)據(jù)
HBase列出表
HBase刪除數(shù)據(jù)
HBase讀取數(shù)據(jù)
HBase常用命令
HBase更新數(shù)據(jù)
HBase關閉
HBase架構
HBase Shell
HBase Exists
HBase安全
HBase教程
HBase啟用表
HBase計數(shù)和截斷
HBase刪除表

HBase Exists

可以使用exists命令驗證表的存在。下面的示例演示了如何使用這個命令。

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驗證表的存在

可以使用HBaseAdmin類的tableExists()方法驗證表在HBase中是否存在。按照下面給出的步驟驗證HBase表存在。

第1步

Instantiate the HBaseAdimn class

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

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

第2步

使用tableExists()方法來驗證表的存在。

下面給出的是使用java程序中的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);
   }
} 

編譯和執(zhí)行上述程序如下所示。

$javac TableExists.java
$java TableExists 

下面列出的是輸出:

true

上一篇:HBase架構下一篇:HBase刪除表