Es-hbase-hbase-describe-and-alter

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

HBase-説明の変更

Describir

タブラの説明文。 Su sintaxis es la siguiente:

hbase> describe 'table name'

連続した音楽は、タブラについて説明します。

hbase(main):006:0> describe 'emp'
   DESCRIPTION
      ENABLED

'emp', {NAME => 'READONLY', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER
=> 'ROW', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS =>
'1', TTL true


=> 'FOREVER', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'false',
BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME
=> 'personal


data', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW',
REPLICATION_SCOPE => '0', VERSIONS => '5', COMPRESSION => 'NONE',
MIN_VERSIONS => '0', TTL


=> 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536',
IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'professional
data', DATA_BLO


CK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0',
VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL =>
'FOREVER', K


EEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY =>
'false', BLOCKCACHE => 'true'}, {NAME => 'table_att_unset',
DATA_BLOCK_ENCODING => 'NO

NE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', COMPRESSION =>
'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0',
KEEP_DELETED_CELLS


=> 'false', BLOCKSIZE => '6

Modificar

タブラの存在を確認してください。 Mediante este comando、puede cambiar elnúmeromáximode celdas de una columna familia、establecer y eliminar tabla operadores y eliminar una columna de una tabla。

Cambiar elnúmeromáximodecélulasde una columna

連帯は、カンビアの新統派のシンタクシスであり、列柱である。

hbase> alter 't1', NAME => 'f1', VERSIONS => 5

En el ejemplo siguiente、elnúmeromáximode celdas se establece en 5。

hbase(main):003:0> alter 'emp', NAME => 'personal data', VERSIONS => 5
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
0 row(s) in 2.3050 seconds

Los operadores Tabla

usar alter、puede establecer y eliminar tabla operadores como MAX_FILESIZE、READONLY MEMSTORE_FLUSHSIZE、DEFERRED_LOG_FLUSHなど

デ・ソロ・レクチュラ

シンタクシスの連続性は、タブラソロレクチュラであります。

hbase>alter 't1', READONLY(option)

En el siguiente ejemplo、hemos hecho la emp tabla。 ソロレクトラ。

hbase(main):006:0> alter 'emp', READONLY
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
0 row(s) in 2.2140 seconds

Los operadores Eliminar Tabla

Tambiénpodemos sacar la mesa alcance los operadores。 継続的なシンタクシスの回避策「MAX_FILESIZE de emp。

hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'

エリミナウナコラムナ

Usar alter、tanbiénpuede eliminar una columna。 連続した音楽のシンタクシスパラエリミナーウナコラムナユーサンドアルター。

hbase> alter ‘ table name ’, ‘delete’ => ‘ column family ’

連続した音楽の列は、タブラ 'emp。

Supongamos que tiene una tabla denominada empleado en HBase。 Contiene los siguientes datos:

hbase(main):006:0> scan 'employee'

         ROW                   COLUMN+CELL

row1 column=personal:city, timestamp=1418193767, value=hyderabad

row1 column=personal:name, timestamp=1418193806767, value=raju

row1 column=professional:designation, timestamp=1418193767, value=manager

row1 column=professional:salary, timestamp=1418193806767, value=50000

1 row(s) in 0.0160 seconds

Ahora vamos a eliminar la columna familiaプロフェッショナルなメディアエルコマンドmodificar。

hbase(main):007:0> alter 'employee','delete'=>'professional'
Updating all regions with the new schema...
0/1 regions updated.
1/1 regions updated.
Done.
0 row(s) in 2.2380 seconds

Ahora compruebe los datos en la tabladespuésde lamodificación。 コラム「専門家」の観察は、エス・マ、ヤ・ケ・ヘモス・エリミナードです。

hbase(main):003:0> scan 'employee'
 ROW             COLUMN+CELL
row1 column=personal:city, timestamp=14181936767, value=hyderabad

row1 column=personal:name, timestamp=1418193806767, value=raju

1 row(s) in 0.0830 seconds

JavaのAPIを使用した列の複製

コラムの要約と、 HBAseAdmin クラスの追加列の追加。 Siga los pasos que se indican acontinuaciónpara agregar una columna a una tabla。

手順1

*HBaseAdmin* クラスのインスタンス。
//Instantiating configuration object
Configuration conf = HBaseConfiguration.create();

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

手順2

  • addColumn()タブを使用して、 *HColumnDescriptor クラスのタブ名を取得する必要があります。 HColumnDescriptor のクラスを使用して、タントクレイのインスタンスを作成します。 エルコンストラクターの HColumnDescriptor は、集計関数の列の名前を要求します。 Aquíestamos agregando una columna llamada「contactDetails」と実際の「empleado」タブラ。
//Instantiating columnDescriptor object

HColumnDescriptor columnDescriptor = new
HColumnDescriptor("contactDetails");

手順3

addcolumnを使用して、列のファミリを作成します。 タブラエルオブジェクトオブラクラスHColumnDescriptor comoparámetrosde estemétodo。

//Adding column family
admin.addColumn("employee", new HColumnDescriptor("columnDescriptor"));

連続したプログラムは完全なパラ集合体と列柱とタブラの存在を含んでいます。

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class AddColoumn{

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

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

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

     //Instantiating columnDescriptor class
      HColumnDescriptor columnDescriptor = new HColumnDescriptor("contactDetails");

     //Adding column family
      admin.addColumn("employee", columnDescriptor);
      System.out.println("coloumn added");
   }
}

連続した番組の連続番組

$javac AddColumn.java
$java AddColumn

.bashrc 」のクラスパスの設定が可能です。 Si no lo han hecho、siga el procedimiento que se detalla acontinuaciónpara compilar el archivo .java。

//if "/home/home/hadoop/hbase " is your Hbase home folder then.
$javac -cp/home/hadoop/hbase/lib/*: Demo.java

Si todo va bien、seproduciráel siguiente resultado:

 column added

JavaのAPIを使用してファミリを削除する

コラムを削除しました。タブラを使用します。* deleteColumn() de HBAseAdmin *クラス。 Siga los pasos que se indican acontinuaciónpara agregar una columna a una tabla。

手順1

*HBaseAdmin* クラスのインスタンス。
//Instantiating configuration object
Configuration conf = HBaseConfiguration.create();

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

パソ2

コラムファミリファミリユーティリティ* deleteColumn()*。 タブライラコラムナノムデラファミリアコモパラメトロスデエステメトド。

//Deleting column family
admin.deleteColumn("employee", "contactDetails");

継続的なタブラの存在を含むプログラムの完全なプログラムが含まれています。

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class DeleteColoumn{

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

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

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

     //Deleting a column family
      admin.deleteColumn("employee","contactDetails");
      System.out.println("coloumn deleted");
   }
}

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

$javac DeleteColumn.java
$java DeleteColumn

Lo siguiente debe ser el producto:

column deleted