Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2353476
  • 博文数量: 276
  • 博客积分: 5998
  • 博客等级: 大校
  • 技术积分: 5175
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 14:43
文章分类

全部博文(276)

文章存档

2014年(25)

2013年(11)

2012年(69)

2011年(167)

2010年(4)

分类: 大数据

2014-04-18 14:27:59

共四台服务器
10.14.2.201(HMaster)
10.14.2.2021(HRegionServers)backup-masters
10.14.2.203(HRegionServers)backup-masters
10.14.2.204(HRegionServers)backup-masters

hadoop版本1.2.1
zookeeper 版本3.4.5
hbase 版本0.94.18


1、安装部署java

2、安装部署hadoop1.2.1

3、安装部署zookeeper
http://blog.chinaunix.net/uid-25135004-id-4214399.html

安装部署配置hbase(在所有机器上执行)
4、解压hbase-0.94.18.tar.gz
tar xvf hbase-0.94.18.tar.gz  -C /export/
cd /export/
ln -s hbase-0.94.18 hbase
 
5、配置hbase-env.sh
cd /export/hbase/conf
vim hbase-env.sh

点击(此处)折叠或打开

  1. export JAVA_HOME=/usr/java/jdk1.6.0_32/
  2. export HBASE_MANAGES_ZK=false
HBASE_MANAGES_ZK false为使用独立的zookeeper,ture使用habase自带的zookeeper

6、配置hbase-site.xml
vim hbase-site.xml

点击(此处)折叠或打开

  1.     
  2.         hbase.rootdir
  3.         hdfs://10.14.2.201:9000/hbase
  4.         The directory shared byRegionServers.
  5.         
  6.     
  7.     
  8.         hbase.cluster.distributed
  9.         true
  10.         The mode the clusterwill be in. Possible values are
  11.             false: standalone and pseudo-distributedsetups with managed Zookeeper
  12.             true: fully-distributed with unmanagedZookeeper Quorum (see hbase-env.sh)
  13.         
  14.     
  15.     
  16.         hbase.zookeeper.property.clientPort
  17.         2181
  18.         Property fromZooKeeper's config zoo.cfg.
  19.             The port at which the clients willconnect.
  20.         
  21.     
  22.     
  23.         hbase.zookeeper.quorum
  24.         10.14.2.201,10.14.2.202,10.14.2.203,10.14.2.204
  25.         Comma separated listof servers in the ZooKeeper Quorum.
  26.             For example,"host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
  27.             By default this is set to localhost forlocal and pseudo-distributed modes
  28.             of operation. For a fully-distributedsetup, this should be set to a full
  29.             list of ZooKeeper quorum servers. IfHBASE_MANAGES_ZK is set in hbase-env.sh
  30.             this is the list of servers which we willstart/stop ZooKeeper on.
  31.         
  32.     
  33.     
  34.         hbase.zookeeper.property.dataDir
  35.         /export/zookeeper/data
  36.         Property fromZooKeeper's config zoo.cfg.
  37.             The directory where the snapshot isstored.
  38.         
  39.     

 hbase.rootdir 为HDFS的NameNode的位置。 例如,你的namenode运行在10.14.2.201,端口是9000 你期望的hbase目录是 /hbase,配置:hdfs://10.14.2.201:9000/hbase
 hbase.cluster.distributed :Hbase的运行模式。false是单机模式,true是分布式模式。若为false,Hbase和Zookeeper会运行在同一个JVM里面
 hbase.zookeeper.property.clientPort:ZooKeeper的zoo.conf中的配置。 客户端连接的端口
 hbase.zookeeper.quorum:Zookeeper集群的地址列表,用逗号分割。
 hbase.zookeeper.property.dataDir:ZooKeeper 快照的存储位置
 
7、配置 regionservers

 vim regionservers

点击(此处)折叠或打开

  1. 10.14.2.202
  2. 10.14.2.203
  3. 10.14.2.204

 配置你希望运行的全部 HRegionServer,一行写一个ip或者域名,这里的server会随着集群的启动而启动,集群的停止而停止。

8、配置backup-masters 
为了保证HBase集群的高可靠性,HBase支持多Backup Master 设置。当Active Master挂掉后,Backup Master可以自动接管整个HBase的集群。
vim backup-masters  

点击(此处)折叠或打开

  1. 10.14.2.202
  2. 10.14.2.203
  3. 10.14.2.204

9、替换habase/lib 目录下的hadoop-core-1.0.4.jar包
rm -rf /export/hbase/lib/hadoop-core-1.0.4.jar 
cp /export/hadoop/hadoop-core-1.2.1.jar  /export/hbase/lib/

10、更改权限
chown hadoop.hadoop -R /export/hbase
chown hadoop.hadoop -R /export/hbase/

11、在10.14.2.201(HMaster)启动hbase
su - hadoop
[hadoop@master ~]$ /export/hbase/bin/start-hbase.sh 
starting master, logging to /export/hbase/bin/../logs/hbase-hadoop-master-master.hadoop.out
10.14.2.202: starting regionserver, logging to /export/hbase/bin/../logs/hbase-hadoop-regionserver-slave1.hadoop.out
10.14.2.203: starting regionserver, logging to /export/hbase/bin/../logs/hbase-hadoop-regionserver-slave2.hadoop.out
10.14.2.204: starting regionserver, logging to /export/hbase/bin/../logs/hbase-hadoop-regionserver-slave3.hadoop.out

12、执行jps查看服务

10.14.2.201(HMaster)上执行
[hadoop@master ~]$ jps
30660 Jps
5192 SecondaryNameNode
4898 JobTracker
30483 HMaster
4716 NameNode

10.14.2.202(HRegionServers)上执行
[hadoop@slave1 ~]$ jps
21937 Jps
16740 QuorumPeerMain
14967 DataNode
15073 TaskTracker
21722 HRegionServer
21793 HMaster

10.14.2.203(HRegionServers)上执行
[root@slave2 hadoop]# su - hadoop
[hadoop@slave2 ~]$ jps
21471 HMaster
21627 Jps
15384 TaskTracker
15277 DataNode
21399 HRegionServer
16460 QuorumPeerMain

10.14.2.204(HRegionServers)上执行
[hadoop@slave3 ~]$ jps
16294 QuorumPeerMain
30910 HMaster
29893 DataNode
30839 HRegionServer
29987 TaskTracker
31071 Jps

13、进入hbase 无异常抛出

[hadoop@master ~]$ /export/hbase/bin/hbase shell
HBase Shell; enter 'help' for list of supported commands.
Type "exit" to leave the HBase Shell
Version 0.94.18, r1577788, Sat Mar 15 04:46:47 UTC 2014
hbase(main):001:0> list
TABLE                                                                                                                                     
0 row(s) in 1.1330 seconds
hbase(main):002:0> 

14、通过WEB页面来管理查看HBase数据库。
HMaster:


15、此时hbase 安装部署配置完毕

阅读(7960) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~