1、安裝JDK, Hadoop
2、下載 hbase 安裝包
3、編輯 hbase/conf/hbase-site.xml
<configuration> <property> <!-- hbase提供的服務地址--> <name>hbase.master</name> <value>10.1.234.209:6000</value> </property> <property> <name>hbase.master.maxclockskew</name> <value>180000</value> </property> <property> <!-- hbase在hdfs里的目錄 --> <name>hbase.rootdir</name> <value>hdfs://10.1.234.209:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <!-- ZK的主機地址 --> <name>hbase.zookeeper.quorum</name> <value>10.1.234.204</value> </property> <property> <!-- hbase在ZK上保存數據的目錄 --> <name>hbase.zookeeper.property.dataDir</name> <value>/hbase</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>
4、編輯 conf/hbase-env.sh
設置JAVA_HOME
5、編輯 conf/regionservers
regionserver的地址,測試,只配置了本機
6、bin/start-hbase.sh
啟動后,jps可以看到有這兩個進程
HRegionServer
HMaster
7、啟動 Hbase的rest服務
bin/hbase rest start -p 6000
bin/hbase rest start 不加端口,默認是 8080
bin/hbase-daemon.sh rest start 后台啟動REST服務
啟動后,jps可以看到這個進程
RESTServer
8、啟動Hbase Shell
bin/hbase shell
9、訪問HBase UI
http://10.1.234.209:8085/
不同的這個REST端口號不同,可使用jps、netstat -ntlp|grep PID來獲取端口號
詳細命令,參考:http://www.cnblogs.com/nexiyi/p/hbase_shell.html
遇到的問題:
INFO [org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation] getMaster attempt 1 of 31 failed; retrying after sleep of 100, exception=com.google.protobuf.ServiceException: org.apache.hadoop.net.ConnectTimeoutException: 20000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.SocketChannel[connection-pending remote=c3pretest6/50.57.34.52:16000]
這個問題困擾了我好久,后來參考了這篇文章,需要將HMaster的ip和主機名的映射關系維護到Client端(Windows)的hosts文件