搭建hbase的完全分布式模式

来源:互联网 发布:淘宝图片轮播怎么做 编辑:程序博客网 时间:2024/05/29 18:30

1.安装Hadoop

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

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=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 connectclientPort=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/hadoopexport 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

node5node4node3


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



原创粉丝点击