美文网首页
HBase常见问题

HBase常见问题

作者: 金字塔下的小蜗牛 | 来源:发表于2020-04-10 08:38 被阅读0次

    问题1:启动Hbase时出现如下的信息,说明HBase中的slf4j-log4j12-1.7.25.jar和Hadoop中的slf4j-log4j12-1.7.10.jar冲突。

    [root@localhost ~]# start-hbase.sh
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/root/trainings/hbase-2.0.1/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/root/trainings/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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]

    解决方案:

    step1:将HBase下的新版本slf4j-log4j12-1.7.25.jar替换Hadoop目录下的旧版本slf4j-log4j12-1.7.10.jar;

    [root@localhost ~]# rm -f /root/trainings/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar
    [root@localhost ~]# cp /root/trainings/hbase-2.0.1/lib/slf4j-log4j12-1.7.25.jar
    /root/trainings/hadoop-2.7.3/share/hadoop/common/lib/

    step2:删除HBase中的新版本slf4j-log4j12-1.7.25.jar原始文件;

    [root@localhost ~]# rm -f /root/trainings/hbase-2.0.1/lib/slf4j-log4j12-1.7.25.jar

    step3:在HBase中新建一个名为slf4j-log4j12-1.7.25.jar软连接文件,指向Hadoop中的slf4j-log4j12-1.7.25.jar。

    [root@localhost ~]# ln -s /root/trainings/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar
    /root/trainings/hbase-2.0.1/lib/slf4j-log4j12-1.7.25.jar

    问题2:停止HBase时,出现长时间无法停止的情况

    [root@localhost logs]# stop-hbase.sh
    stopping hbase......................................................................
    ....................................................................................
    ....................................................................................
    ....................................................................................
    ............................^C

    解决办法:【权宜之计】Ctrl + C杀掉任务,再执行一遍即可

    [root@localhost ~]# stop-hbase.sh
    stopping hbase.........
    localhost: running zookeeper, logging to /root/trainings/hbase-2.0.1/bin/../logs/hbase-root-zookeeper-localhost.out
    localhost: stopping zookeeper.

    终极解决办法:将hbase-env.sh中的HBASE_MANAGES_ZK置为true:

    [root@localhost ~]# vim /root/trainings/hbase-2.0.1/conf/hbase-env.sh
    # Tell HBase whether it should manage it's own instance of ZooKeeper or not.
    export HBASE_MANAGES_ZK=true

    [root@localhost ~]# stop-hbase.sh
    stopping hbase............................
    localhost: running zookeeper, logging to /root/trainings/hbase-2.0.1/bin/../logs/hbase-root-zookeeper-localhost.out
    localhost: stopping zookeeper.

    问题3:进入hbase shell时,报错无法加载native-hadoop库文件

    [root@localhost ~]# hbase shell
    2018-07-25 21:42:26,023 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library
    for your platform... using builtin-java classes where applicable
    HBase Shell
    Use "help" to get list of supported commands.
    Use "exit" to quit this interactive shell.
    Version 2.0.1, r987f7b6d37c2fcacc942cc66e5c5122aba8fdfbe, Wed Jun 13 12:03:55 PDT 2018
    Took 0.0016 seconds
    hbase(main):001:0>

    问题4:启动HBase时出现如下信息,说明ZooKeeper已经启动了,因为HBase会自动启动ZooKeeper,所以不用事先单独启动ZooKeeper。

    [root@localhost ~]# start-hbase.sh
    localhost: running zookeeper, logging to /root/trainings/hbase-2.0.1/bin/../logs/hbase-root-zookeeper-localhost.out
    localhost: java.net.BindException: 地址已在使用
    localhost: at sun.nio.ch.Net.bind0(Native Method)
    localhost: at sun.nio.ch.Net.bind(Net.java:433)
    localhost: at sun.nio.ch.Net.bind(Net.java:425)
    localhost: at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    localhost: at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    localhost: at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
    localhost: at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:90)
    localhost: at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:117)
    localhost: at org.apache.hadoop.hbase.zookeeper.HQuorumPeer.runZKServer(HQuorumPeer.java:94)
    running master, logging to /root/trainings/hbase-2.0.1/logs/hbase-root-master-localhost.out
    : running regionserver, logging to /root/trainings/hbase-2.0.1/logs/hbase-root-regionserver-localhost.out

    解决办法:启动HBase之前不要手动启动ZooKeeper

    [root@localhost ~]# zkServer.sh stop
    ZooKeeper JMX enabled by default
    Using config: /root/trainings/zookeeper-3.4.10/bin/../conf/zoo.cfg
    Stopping zookeeper ... STOPPED
    [root@localhost ~]# start-hbase.sh
    localhost: running zookeeper, logging to /root/trainings/hbase-2.0.1/bin/../logs/hbase-root-zookeeper-localhost.out
    running master, logging to /root/trainings/hbase-2.0.1/logs/hbase-root-master-localhost.out
    : running regionserver, logging to /root/trainings/hbase-2.0.1/logs/hbase-root-regionserver-localhost.out

    相关文章

      网友评论

          本文标题:HBase常见问题

          本文链接:https://www.haomeiwen.com/subject/vvvkdhtx.html