您的位置:首页 > 运维架构 > Apache

Hbase建表ERROR: org.apache.Hadoop.hbase.MasterNotRunningException: Retried 7 times

2017-07-06 10:30 477 查看
运行Hbase时常会遇到个错误:ERROR: org.apache.Hadoop.hbase.MasterNotRunningException:
Retried 7 times



它告诉 MasterNotRunningException,说明HMaster没有运行起来而导致.对于这个问题,我仔细的研究了一下,发现出现这个问题的原因有以下几种:

1.1 : Hbase的配置文件hbase-env.sh hbase-site.xml 没配置好

先看一下hbase-env.sh 配置文件需要配置属性.是否与自己的路径相对应.

# The java implementation to use. Java 1.6 required.

export JAVA_HOME=/usr/local/jdk1.7.0_79

# Extra Java CLASSPATH elements. Optional.

export HBASE_CLASSPATH=/usr/local/hadoop-2.6.0/conf

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

export HBASE_MANAGES_ZK=true

在看一下hbase-site.xml 文件

<configuration>

<property>

<name>hbase.rootdir</name>

<value>hdfs://tb1:9000/hbase</value> 这里的tb1需要和/etc/hosts文件映射的IP相对应

</property>

<property>

<name>hbase.cluster.distributed</name>

<value>true</value>

</property>

<property>

<name>hbase.zookeeper.quorum</name> //这里需要特别注意,有些版本没有这个配置,需要自己手动添加

<value>tb1</value>

</property>

</configuration>

下面打开一下hosts文件

命令行输入: sudo vim /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

123.58.173.185 mirrors.163.com

192.168.56.102 tb1

192.168.56.103 tb2

192.168.56.104 tb3

如果以上配置OK ,重新启动bin/start-hbase.sh , 然后jps一下.

[root@tb1 local]# jps

8710 HQuorumPeer

7950 SecondaryNameNode

8966 Jps

8768 HMaster

3808 HRegionServer

8099 ResourceManager

8884 HRegionServer

7765 DataNode

7675 NameNode

8191 NodeManager

说明配置一切OK, 进入hbase shell.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1.2

如以上全部OK,但是依旧报错.原因就只有一个了,说明你安装的hbase的版本太低,与Hadoop版本相容性太差,导致HMaster无法正常启动.需要升级一下hbase版本.

在预安装新版本的hbase,避免再次配置麻烦,就先将原来的hbase-env.sh hbase-site.xml 文件cp到其他目录.

[root@tb1 conf]# cp hbase-env.sh
/usr/local/

[root@tb1 conf]# cp hbase-site.xml /usr/local/

我这里有hbase-1.1.2-bin.tar.gz

https://pan.baidu.com/s/1pLOAwwb


Root用户下操作
1、解压安装
将hbase-1.1.2-bin.tar.gz拿U盘复制到/usr/local目录下
在/usr/local目录下,解压安装
[root@tb1 local]# tar -zvxf hbase-1.1.2-bin.tar.gz
进入hbase的配置文件目录
[root@tb1 local]# cd hbase-1.1.2/conf/

将之前的配置文件cp到新hbase里
[root@tb1 conf]# cp /usr/local/hbase-env.sh /usr/local/hbase-1.1.2/conf

cp:是否覆盖"/usr/local/hbase-1.1.2/conf/hbase-env.sh"? y


root@tb1 conf]# cp /usr/local/hbase-site.xml /usr/local/hbase-1.1.2/conf

cp:是否覆盖"/usr/local/hbase-1.1.2/conf/hbase-env.sh"? y

然后改写一下配置文件
[root@tb1 hbase-1.1.2]# sudo vim /etc/profile

export HBASE_HOME=/usr/local/hbase-1.1.2

[root@tb1 hbase-1.1.2]# source /etc/profile

重新启动bin/start-hbase.sh , 然后jps一下.
[root@tb1 local]# jps

8710 HQuorumPeer

7950 SecondaryNameNode

8966 Jps

8768 HMaster

3808 HRegionServer

8099 ResourceManager

8884 HRegionServer

7765 DataNode

7675 NameNode

8191 NodeManager
在进入hbase shell
[root@tb1 local]# hbase shell

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/usr/local/hbase-1.1.2/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

2017-07-06 03:03:03,869 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

HBase Shell; enter 'help<RETURN>' for list of supported commands.

Type "exit<RETURN>" to leave the HBase Shell

Version 1.1.2, rcc2b70cf03e3378800661ec5cab11eb43fafe0fc, Wed Aug 26 20:11:27 PDT 2015

hbase(main):001:0> create 'test','cf'

0 row(s) in 3.2480 seconds

=> Hbase::Table - test

hbase(main):002:0> list 'table'

TABLE

0 row(s) in 0.0640 seconds

=> []

OK了大功告成.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐