搭建hbase的完全分布式模式

1.安装Hadoop

2.安装zookeeper。我只安装了一台zookeeper。比较简单。使用zookeeper的默认配置就可以。zookeeper的默认端口是2181.下面是我的zoo.cfg文件

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/data/zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

3.启动zookeeper

进入bin目录运行

./zkServer.sh  start
4.配置hbase-env.sh文件,我只挑选了我更改过的配置

# The java implementation to use.  Java 1.7+ required.
export JAVA_HOME=/opt/op/jdk1.8.0_144

# Extra Java CLASSPATH elements.  Optional.
export HBASE_CLASSPATH=/opt/op/hadoop-2.7.4/etc/hadoop

export HBASE_LOG_DIR=${HBASE_HOME}/logs

# Enable remote JDWP debugging of major HBase processes. Meant for Core Developers 
# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8071"
# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8072"
# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8073"

# A string representing this instance of hbase. $USER by default.
# export HBASE_IDENT_STRING=$USER

# The scheduling priority for daemon processes.  See 'man nice'.
# export HBASE_NICENESS=10

# The directory where pid files are stored. /tmp by default.
export HBASE_PID_DIR=/var/hadoop/pids

# Seconds to sleep between slave commands.  Unset by default.  This
# can be useful in large clusters, where, e.g., slave rsyncs can
# otherwise arrive faster than the master can service them.
# export HBASE_SLAVE_SLEEP=0.1

# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false

5.配置hbase-site.xml

<configuration>
	<!--hdfs nameservice-->
	<property>
		<name>hbase.rootdir</name>
		<value>hdfs://node5:9000/hbase</value>
	</property>
	<!--
	<property>
		<name>hbase.zookeeper.property.dataDir</name>
		<value>/home/hadoop/zookeeper</value>
	</property>
	-->	
	<property>
		<name>hbase.cluster.distributed</name>
		<value>true</value>
	</property>
	<property>
		<name>hbase.zookeeper.quorum</name>
		<value>node5</value>
	</property>
	<!--info port-->
	<property>
        <name>hbase.master.info.port</name>
        <value>60010</value>
 </property>
6.配置备份用的master 。在conf目录新建backup-masters文件,在里面填写备份用的地址:

node4
7.配置regionservers

node5
node4
node3


8.在master上运行


./start-hbase.sh 

9.运行jps,在master上应该包含如下进程   HMaster进程

在zookeeper上应该包含:QuorumPeerMain进程

在regionserver上应该包含:HRegionServer进程

在备份master上应该包含:HMaster进程

如果出现:刚开始有上面的进程,过段时间,进程消失了,并且出现org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hbase.ClockOutOfSyncException: ,应该调整一下系统时间与master一致 。

1.调整各个服务器的时间与Internet时间一致:、

ntpdate -u ntp.api.bz

2.重新启动hbase

10.在网页上查看hmaster

http://node5:16030



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值