このトピックでは、HBaseクラスターを構成し、HBaseストレージサービスを使用する方法について説明します。
前提条件
E-MapReduce(EMR)クラスターが作成され、HBaseサービスがクラスターに追加されています。詳細については、「クラスターの作成」をご参照ください。
HBaseクラスターの構成
HBaseクラスターを作成する際に、[ソフトウェア設定] ステップの [詳細設定] セクションで [カスタムソフトウェア設定] を有効にし、デフォルトのHBase構成を変更できます。例:
{
"configurations": [
{
"classification": "hbase-site",
"properties": {
"hbase.hregion.memstore.flush.size": "268435456",
"hbase.regionserver.global.memstore.size": "0.5",
"hbase.regionserver.global.memstore.lowerLimit": "0.6"
}
}
]
}
次の表に、デフォルトのHBase構成を示します。
キー | 値 |
zookeeper.session.timeout | 180000 |
hbase.regionserver.global.memstore.size | 0.35 |
hbase.regionserver.global.memstore.lowerLimit | 0.3 |
hbase.hregion.memstore.flush.size | 128MB |
HBaseへのアクセス
- SSHモードでクラスターのマスターノードに接続します。詳細については、「クラスターへのログイン」をご参照ください。
次のコマンドを実行して、HBase Shellにアクセスします。
hbase shell
次の情報が返されます。
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/apps/ecm/service/hbase/1.4.9-1.0.0/package/hbase-1.4.9-1.0.0/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/apps/ecm/service/hadoop/2.8.5-1.5.3/package/hadoop-2.8.5-1.5.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] HBase Shell Use "help" to get list of supported commands. Use "exit" to quit this interactive shell. Version 1.4.9, r8214a16c5d80f077abf1aa01bb312851511a2b15, Thu Jan 31 20:35:22 CST 2019 hbase(main):001:0>
説明ECSコンソールで作成したインスタンスを使用する場合は、「HBase Shell を使用して ApsaraDB for HBase Standard Edition クラスターにアクセスする」を参照してください。
例
Sparkを使用してHBaseにアクセスする
詳細については、「spark-hbase-connector」をご参照ください。
Hadoopを使用してHBaseにアクセスする
詳細については、「HBase MapReduce Examples」をご参照ください。
Hiveを使用してHBaseにアクセスする
Hiveクラスターのマスターノードにログインし、hosts ファイルに次の情報を追加します。
$zk_ip emr-cluster // $zk_ip は、HBaseクラスターのZooKeeperノードのIPアドレスを示します。
Hive関連の操作を実行する方法の詳細については、「Hive HBase Integration」をご参照ください。