hbase集群安装配置
原创
©著作权归作者所有:来自51CTO博客作者upgirl的原创作品,请联系作者获取转载授权,否则将追究法律责任
1、环境介绍
(1)IP 规划
hserver 192.168.0.130
hclient1 192.168.0.131
hclient2 192.168.0.132
(2)软件版本
OS:rhel6.3-x86_64
JDK:jdk1.6.0_41
HADOOP:hadoop-1.1.1
HBASE:hbase-0.94.5
2、Hbase安装
下载地址:http://mirror.bit.edu.cn/apache/hbase/hbase-0.94.5/hbase-0.94.5.tar.gz
解压安装:$tar zvxf hbase-0.94.5.tar.gz
hadoop安装目录:/hadoop/hadoop-1.1.1
hbase安装目录:/hadoop/hbase-0.94.5
3、Hbase配置
(1)$vim hbase-env.sh
export JAVA_HOME=/hadoop/jdk1.6.0_41
export HBASE_CLASSPATH=/hadoop/hadoop-1.1.1
export HBASE_MANAGES_ZK=true
(2)$vim hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hserver:9000/hadoop/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hserver,hclient1,hclient2</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/hadoop/zookeeper</value>
</property>
</configuration>
(3)$vim regionservers
hclient1
hclient2
4、Hbase启停
注意启动顺序:保证Hadoop已经正常启动后,启动 Hbase
启动:$/bin/start-hbases
(1)server端jps查看进程
$jps
9800 Jps
4389 JobTracker
4116 NameNode
4297 SecondaryNameNode
9488 HQuorumPeer
9611 HMaster
(2)slave端jps查看进程
$jps
5359 Jps
2784 DataNode
5190 HRegionServer
2894 TaskTracker
5041 HQuorumPeer
5、Hbase 操作
(1)Web 方式
Hbase Master 访问地址 http://hserver:60010
Region Server 访问地址 http://hclient1:60030
(2)Shell 方式
$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.5, r1443843, Fri Feb 8 05:51:25 UTC 2013
//查看所有表:list
hbase(main):001:0> list
TABLE
0 row(s) in 0.4950 seconds
//创建表:create '表名称', '列名称1','列名称2','列名称N'
hbase(main):011:0> create 'user','no','name'
0 row(s) in 1.0430 seconds
//添加记录:put '表名称', '行名称', '列名称:', '值'
hbase(main):015:0> put 'user','1','name','upgirl'
0 row(s) in 0.0100 seconds
//查看记录:get '表名称', '行名称
hbase(main):021:0> get 'user','1'
COLUMN CELL
name: timestamp=1362636502868, value=upgirl
1 row(s) in 0.0150 seconds
//禁用表:disable '表名称'
hbase(main):022:0> disable 'user'
0 row(s) in 2.0710 seconds
//删除表:drop '表名称'
hbase(main):023:0> drop 'user'
0 row(s) in 1.0490 seconds
hbase(main):024:0> list
TABLE
0 row(s) in 0.0090 seconds
6、遇到的问题:
(1)jps查看slave节点,HRegionServer进程未启动,hbase-hadoop-regionserver-hclient1.log日志报错
FATAL org.apache.hadoop.hbase.regionserver.HRegionServer: Master rejected startup because clock is out of sync
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server hclient1,60020,1362557838693 has been rejected; Reported time is too far out of sync with master. Time difference of 43200339ms > max allowed of 30000ms
原因:时钟不同步
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章