Hbase 0.20 單機安裝
要求:
Java 1.6.x,或以後.
只能搭配於 Hadoop 0.20.x.
ssh 能登入機器並免輸入密碼
HBase 從 0.20 後若要架設完全叢集模式,則需要搭配 ZooKeeper
先運行 sudo ntpdate time.stdtime.gov.tw
資料夾設定
hbase 家目錄
java 安裝所在
hbase metadata
/opt/hbase
/usr/lib/jvm/java-6-sun
/var/hbase
建立hbase.tmp.dir 於 /var/ 資料夾下
$ sudo mkdir /var/hbase
$ sudo chmod 755 /var/hbase
將hbase 解壓縮於 /opt
$ sudo tar -zxvf hbase-*.tar.gz /opt/
$ sudo ln -sf /opt/hbase-0.20.1 /opt/hbase
環境設定
將這一段寫入到 /opt/hbase/conf/conf/hbase-env.sh
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export HBASE_HOME=/opt/hbase
export HBASE_LOG_DIR=/var/hbase/logs
export HBASE_PID_DIR=/var/hbase/pids
單機設定步驟
將這一段寫入到 /opt/hbase/conf/hbase-site.xml 內
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
<description>The directory shared by region servers.
</description>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/var/hbase/${user.name}</value>
<description>Temporary directory on the local filesystem.</description>
</property>
</configuration>
ps:此 hbase.rootdir 目錄由hbase建立即可,不用手動另行操作
執行方法
啟動 hbase
$/opt/hbase/bin/start-hbase.sh
執行 hbase
$/opt/hbase/bin/hbase shell
hbase> # Type "help" to see shell help screen
hbase> help
hbase> # To create a table named "mylittletable" with a column family of "mylittlecolumnfamily", type
hbase> create "mylittletable", "mylittlecolumnfamily"
hbase> # To see the schema for you just created "mylittletable" table and its single "mylittlecolumnfamily", type
hbase> describe "mylittletable"
hbase> # To add a row whose id is "x", to the column "mylittlecolumnfamily:x" with a value of 'x', do
hbase> put "mylittletable", "x"
hbase> # To get the cell just added, do
hbase> get "mylittletable", "x"
hbase> # To scan you new table, do
hbase> scan "mylittletable"
停止 hbase
${HBASE_HOME}/bin/stop-hbase.sh
注意
HBase servers put up 10 listeners for incoming connections by default. Up this number if you have a dataset of any substance by setting hbase.regionserver.handler.count in your hbase-site.xml.
Hosts must be able to resolve the fully-qualified domain name of the master.
Bug Fix
問題解決頁面: http://wiki.apache.org/hadoop/Hbase/Troubleshooting
其他:
FAQ: Why do I see "java.io.IOException...(Too many open files)" in my logs?
HADOOP-4681/HDFS-127 "DFSClient block read failures cause open DFSInputStream to become unusable".