1.インストール前に環境を準備するには、centos7マシンが必要であり、JDKとHadoopをインストールします。
参照:centos7でのHadoop2.7.3のスタンドアロンインストールとデプロイ
注:hadoopのバージョンとHBaseのバージョンに注意を払う必要があります
Centosバージョン:CentOS-7.4-x86_64-DVD-1708.iso
JDKバージョン:jdk-8u231-linux-x64.tar.gz
Hadoopバージョン:hadoop-2.7.3.tar.gz
HBaseバージョン:hbase-2.2.6-bin .tar.gz
2.HBaseインストールパッケージをダウンロードします
ダウンロードリンク:https://mirrors.bfsu.edu.cn/apache/hbase/2.2.6/hbase-2.2.6-bin.tar.gz
3.HBaseをインストールしてデプロイします
3.1 / usr /ディレクトリの下に新しいhbaseディレクトリを作成し、hbaseインストールパッケージhbase-2.2.6-bin.tar.gzをhbaseディレクトリにアップロードして、解凍します。
tar -zxvf hbase-2.2.6-bin.tar.gz
3.2 /usr/hbase/hbase-2.2.6/conf/hbase-env.shファイルを変更してJava環境変数をインポートするには、ファイルの最後に次のコンテンツを追加します。
export JAVA_HOME=/usr/java/jdk1.8.0_231
3.3次のステートメントを実行して、対応するディレクトリを作成します
mkdir -p /usr/hbase/hbase-2.2.6/hbase/
mkdir -p /usr/hbase/hbase-2.2.6/zookeeper/
3.4 / usr / hbase / hbase-2.2.6 / conf / hbase-site.xmlファイルの内容を次のように変更します。
<configuration>
<!-- hbase存放数据目录 -->
<property>
<name>hbase.rootdir</name>
<value>file:///data/soft/hbase-2.2.6/hbase</value>
</property>
<!-- ZooKeeper数据文件路径 -->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/hbase/hbase-2.2.6/zookeeper</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>
Controls whether HBase will check for stream capabilities (hflush/hsync).
Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
with the 'file://' scheme, but be mindful of the NOTE below.
WARNING: Setting this to false blinds you to potential data loss and
inconsistent system state in the event of process and/or node failures. If
HBase is complaining of an inability to use hsync or hflush it's most
likely not a false positive.
</description>
</property>
</configuration>
3.5環境変数にhbaseを追加し、vi / etc / profileを実行し、ファイルの最後に次のコンテンツを追加し、ソース/ etc / profileを実行して有効にします。
export HBASE_HOME=/usr/hbase/hbase-2.2.6
export PATH=$HBASE_HOME/bin:$PATH
3.6 hbaseを開始および停止し、/ usr / hbase / hbase-2.2.6 /ディレクトリに入ります
# 启动hbase
./bin/start-hbase.sh
# 停止hbase
./bin/stop-hbase.sh
ブラウザでアクセスします:http://192.168.1.9:16010 / master-status
4. hbaseシェルクライアントを使用してHBaseに接続し、関連する操作を実行します
4.1 / usr / hbase / hbase-2.2.6 /ディレクトリに入ります。
./bin/hbase shell
4.2 createコマンドを使用して新しいテーブルを作成し、テーブル名とColumnFamily名を指定します。
create 'test01', 'che01'
4.3 listコマンドを使用して、テーブルが存在することを確認します
list 'test01'
4.4 configureのデフォルトを含む詳細情報を表示するには、describeコマンドを使用します
describe 'test01'
4.5 putコマンドを使用して、データをテーブルに配置します
put 'test01', 'row1', 'che01:01', 'value1'
put 'test01', 'row2', 'che01:02', 'value2'
put 'test01', 'row3', 'che01:03', 'value3'
#
scan 'test01'
4.6私の単一データの1つを表示する
get 'test01', 'row2'