虚拟机zookeeper和hbase集群搭建

Posted wanli002

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了虚拟机zookeeper和hbase集群搭建相关的知识,希望对你有一定的参考价值。

集群zookeeper

dataDir=/usr/local/zookeeper/dataDir
dataLogDir=/usr/local/zookeeper/dataLogDir
# the port at which the clients will connect
clientPort=2181
# master
server.1=sjck-node01:2888:3888
server.2=sjck-node02:2888:3888
server.3=sjck-node03:2888:3888

myid

[[email protected] dataDir]# cat /usr/local/zookeeper/dataDir/myid 
1
[[email protected] dataDir]# cat /usr/local/zookeeper/dataDir/myid 
2
[[email protected] dataDir]# cat /usr/local/zookeeper/dataDir/myid 
3

环境配置

export ZK_HOME=/usr/local/zookeeper
export PATH=$PATH:$ZK_HOME/bin

source  /etc/profile

集群启动,在每台机子上都执行

/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/bin/zkServer.sh stop

查看集群状态

[[email protected] dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[[email protected] dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[[email protected] dataDir]# /usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: leader

hbase环境配置

export HBASE_HOME=/usr/local/hbase
export PATH=$PATH:$HBASE_HOME/bin

source  /etc/profile

查看版本

[[email protected] hbase]# hbase version
HBase 1.3.1
Source code repository git://mantonov-mbp1/Users/mantonov/hbase revision=930b9a55528fe45d8edce7af42fef2d35e77677a
Compiled by mantonov on Thu Apr  6 19:36:54 PDT 2017
From source with checksum a34b810bed77b3a56af797405bea7c78

hbase-env.sh

export JAVA_HOME=/usr/local/src/jdk/jdk1.8
export HBASE_MANAGES_ZK=false
export HADOOP_HOME=/usr/local/hadoop
export HBASE_HOME=/usr/local/hbase
export HBASE_CLASSPATH=/usr/local/hadoop/etc/hadoop/

hbase-site.xml

<configuration>
? ? <property>
? ? ? ? <name>hbase.rootdir</name>
? ? ? ? <value>hdfs://sjck-node01:9000/hbase</value>
? ? </property>
? ? <property>
? ? ? ? <name>hbase.master</name>
? ? ? ? <value>sjck-node01:60000</value>
? ? </property>
? ? <property>
? ? ? ? <name>hbase.cluster.distributed</name>
? ? ? ? <value>true</value>
? ? </property>
? ? <property>
? ? ? ? <name>hbase.zookeeper.property.clientPort</name>
? ? ? ? <value>2181</value>
? ? </property>
? ? <property>
? ? ? ? <name>hbase.zookeeper.quorum</name>
? ? ? ? <value>sjck-node01,sjck-node02,sjck-node03</value>
? ? </property>
? ? <property>
? ? ? ? <name>zookeeper.session.timeout</name>
? ? ? ? <value>120000</value>
? ? </property>
? ? <property>
? ? ? ? <name>dfs.support.append</name>
? ? ? ? <value>true</value>
? ? </property>
</configuration>

regionservers

sjck-node02
sjck-node03

master启动hbase

start-hbase.sh
stop-hbase.sh

集群启动状态,主节点是HMaster,其余是HRegionServer

[[email protected] bin]# jps
3104 NameNode
3893 HMaster
4133 Jps
3273 SecondaryNameNode
3739 QuorumPeerMain
3455 ResourceManager
[[email protected] local]# jps
3157 DataNode
3477 HRegionServer
3270 NodeManager
3403 QuorumPeerMain
3679 Jps
[[email protected] local]# jps
3731 HRegionServer
3923 Jps
3399 DataNode
3656 QuorumPeerMain
3517 NodeManager

web管理页面

http://172.16.92.128:16010/master-status
技术图片

hbase shell

[[email protected] bin]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
hbase(main):001:0> 

以上是关于虚拟机zookeeper和hbase集群搭建的主要内容,如果未能解决你的问题,请参考以下文章

HBase集群部署

大数据学习系列之七 ----- Hadoop+Spark+Zookeeper+HBase+Hive集群搭建 图文详解

Spark集群框架搭建VM15+CentOS7+Hadoop+Scala+Spark+Zookeeper+HBase+Hive

centos7虚拟机在集群zookeeper上面配置hbase的具体操作步骤

大数据学习系列之七 ----- Hadoop+Spark+Zookeeper+HBase+Hive集

linux虚拟机搭建Zookeeper集群环境