hbase1.2.4安装

匹配的hadoop2.6.0,假设hadoop已经正确安装并启动,假设zookeeper已经正确安装并启动。

下载hbase

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不进行管理(启动停止等)

export HBASE_MANAGES_ZK=false

然后编辑hbase-site.xml

<?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>

配置完成后将安装目录发送到其它机器。

执行如下命令启动

./start-hbase.sh

关闭则是

./stop-hbase.sh

webui地址是http://ip:16010

客户端命令

./hbase shell

常用hbase操作命令

#建表
create 'test','cf'
#插入
put 'test','row1','cf:a','value1'
#查询全表
scan 'test'
#查询单条
get 'test','row1'
#禁用表
disable 'test'
#删除表
drop 'test'

猜你喜欢

转载自blog.csdn.net/chenlongjs/article/details/89243820