匹配的hadoop2.6.0,假設hadoop已經正確安裝並啓動,假設zookeeper已經正確安裝並啓動。java
下載hbasenode
cd /opt mkdir hbase wget http://apache.fayea.com/hbase/1.2.4/hbase-1.2.4-bin.tar.gz tar xvzf hbase-1.2.4-bin cd hbase-1.2.4-bin/conf
cd到安裝目錄時,編輯hbase-env.sh,放開以下配置,設置爲false表示使用外部zookeeper集羣,hbase不進行管理(啓動中止等)web
export HBASE_MANAGES_ZK=false
而後編輯hbase-site.xmlshell
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- /** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <configuration> <property> <name>hbase.rootdir</name> <value>hdfs://hadoop-n:9000/hbase</value> <description> hadoop集羣地址 </description> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> <description> 是否啓動集羣模式 </description> </property> <property> <name>hbase.zookeeper.quorum</name> <value>hadoop-n,hadoop-d1,hadoop-d2</value> <description> zookeeper集羣主機名列表 </description> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> <description> zookeeper端口 </description> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/opt/zookeeper/zookeeper-3.4.9/data</value> <description> zookeeper的data目錄 </description> </property> <property> <name>zookeeper.znode.parent</name> <value>/hbase</value> <description> hbase在zookeeper的節點名稱 </description> </property> </configuration>
配置完成後將安裝目錄發送到其它機器。express
執行以下命令啓動apache
./start-hbase.sh
關閉則是app
./stop-hbase.sh
webui地址是http://ip:16010less
客戶端命令oop
./hbase shell
經常使用hbase操做命令ui
#建表 create 'test','cf' #插入 put 'test','row1','cf:a','value1' #查詢全表 scan 'test' #查詢單條 get 'test','row1' #禁用表 disable 'test' #刪除表 drop 'test'