Hbase分布式集群
官方网站:
环境:
CentOS 7.1
hadoop-2.7.2
hbase-1.2.1
jdk-1.8
说明:仅个人测试学习记录,大神们可以一笑而过
Node Name | Master | ZooKeeper | RegionServer |
---|---|---|---|
node-a.example.com |
yes |
yes |
no |
node-b.example.com |
backup |
yes |
yes |
node-c.example.com |
no |
yes |
yes |
前提
至少有一个可用的hdfs实例能正常被hbase所访问
这里直接使用node-a节点的hdfs,请参看Hadoop单节点集群
所以之前core-site.xml里的hdfs://localhost:8020需要改为hdfs://node-a.example.com:8020
安装hbase(所有节点)
配置
1.ssh
密钥认证(node-a.example.com上操作)
node-a需要登录到node-b,node-c上启动daemon
su - hbadmin
ssh-keygen -t dsa -P '' -f
~/.ssh/id_dsa
ssh-copy-id -i ~/.ssh/id_dsa.pub
node-b.example.com
ssh-copy-id -i ~/.ssh/id_dsa.pub
node-c.example.com
2.配置文件修改(node-a.example.com上操作)
a.regionservers
cat >/opt/hbase/conf/regionservers <<HERE
node-b.example.com
node-c.example.com
HERE
b.backup-masters
cat
>/opt/hbase/conf/backup-masters <<HERE
node-b.example.com
HERE
c.zookeeper
/opt/hbase/conf/hbase-site.xml中添加如下选项
注意:因为是集群环境,所以需要将localhost全部替换为能解析的主机名或IP地址
d.同步配置到所有节点(node-a.example.com上操作)
scp -rp /opt/hbase/conf
node-b.example.com:/opt/hbase
scp -rp /opt/hbase/conf
node-b.example.com:/opt/hbase
启动集群
[hbadmin@node-a ~]$
/opt/hbase/bin/start-hbase.sh
node-c.example.com: starting zookeeper, logging
to
/opt/hbase/bin/../logs/hbase-hbadmin-zookeeper-node-c.example.com.out
node-b.example.com: starting zookeeper, logging
to
/opt/hbase/bin/../logs/hbase-hbadmin-zookeeper-node-b.example.com.out
node-a.example.com: starting zookeeper, logging
to
/opt/hbase/bin/../logs/hbase-hbadmin-zookeeper-node-a.example.com.out
starting master, logging to
/opt/hbase/bin/../logs/hbase-hbadmin-master-node-a.example.com.out
node-b.example.com: starting regionserver,
logging to
/opt/hbase/bin/../logs/hbase-hbadmin-regionserver-node-b.example.com.out
node-c.example.com: starting regionserver,
logging to
/opt/hbase/bin/../logs/hbase-hbadmin-regionserver-node-c.example.com.out
node-b.example.com: starting master, logging to
/opt/hbase/bin/../logs/hbase-hbadmin-master-node-b.example.com.out
可以看到启动顺序为zookeeper,master,regionserver,backup master
如果启动失败,请查看报错提示并结合日志排查
[hbadmin@node-a ~]$ /opt/jdk/bin/jps
8076 HMaster
8223 Jps
7967 HQuorumPeer
[hbadmin@node-b ~]$
/opt/jdk/bin/jps
2578 HRegionServer
2503 HQuorumPeer
2653 HMaster
2862 Jps
[hbadmin@node-c ~]$ /opt/jdk/bin/jps
2997 Jps
2794 HQuorumPeer
2877 HRegionServer
web UI
说明:hbase版本比0.98.x要新的web
UI端口由60010(Master),60030(RegionServer)变为
16010(Master),16030(RegionServer)