hbase startup slow - 调用watcher时出错java.lang.NullPointerException:ZK为null

时间:2014-10-25 21:17:09

标签: java hbase apache-zookeeper

最近与我当地的0.94 hbase建立连接的速度非常慢。我得到以下错误。当我将我的mac升级到优胜美地时,我认为它开始发生了。我已经尝试了所有简单的修复,重启,清除数据/ zk目录,重新安装hbase等,但似乎没有任何帮助。

我的配置非常简单,只需覆盖hbase.rootdirhbase.zookeeper.quorumhbase.zookeeper.property.dataDir。我也收到这样的消息:

 java[3323:30250] Unable to load realm info from SCDynamicStore

但是那些先前没有异常堆栈/非常慢的连接。

ZK is null on connection event -- see stack trace for the stack trace when constructor was called on this zkw
java.lang.Exception: ZKW CONSTRUCTOR STACK TRACE FOR DEBUGGING
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:143)
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:127)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:1506)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.ensureZookeeperTrackers(HConnectionManager.java:714)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:787)
    at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:175)
    at com.feedly.normandy.persistence.hbase.PersistenceManager.init(PersistenceManager.java:244)
    at com.feedly.normandy.HBaseUnitTest.createPersistenceManager(HBaseUnitTest.java:152)
    at com.feedly.normandy.HBaseUnitTest.beforeClass(HBaseUnitTest.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
SEVERE: Error while calling watcher 
java.lang.NullPointerException: ZK is null
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.connectionEvent(ZooKeeperWatcher.java:366)
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:303)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:519)
    at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:495)

3 个答案:

答案 0 :(得分:2)

GrepCode Link Here声称ZookKeeperWatcher抛出NullPointerException,因为底层zooKeeper句柄在连接相关事件期间变为null。 我建议在ZK主机上做一个netstat,看看它是否在某个时候丢弃了你的连接。如果您没有看到这种情况,请下载此类的源jar并逐步进入connectionEvent()方法以查看该对象何时为空,这可能会导致您找到根本原因。

答案 1 :(得分:1)

很奇怪,但似乎与localhost查找有关。我尝试了一些来自

的东西

How can I eliminate slow resolving/loading of localhost/virtualhost (a 2-3 second lag) on Mac OS X Lion?

直到我能够快速完成查找,然后一切都变得活泼。

答案 2 :(得分:0)

我的机器上遇到同样的问题。我解决了它,执行以下步骤:

  1. 打开终端并编写命令: hostname - 结果您将看到PC的主机名。复制此名称。

  2. 更改文件 / etc / hosts ,添加从上一步复制的主机名:
    127.0.0.1 localhost {此处放置名称}

  3. 希望这对你也有帮助。