【问题标题】:HBase Java Api gets stuck at put()HBase Java Api 卡在 put()
【发布时间】:2015-10-20 22:15:23
【问题描述】:

我一直在连接到我的 HBase 并使用我的 Java 应用程序非常正常地执行命令。但是最近,一旦我以这种方式获得一张桌子:

Table table = hbconnection.getTable(TableName.valueOf(DOC_TABLE_NAME));

然后它会卡在这样的命令中:

table.put(myput);

我没有例外。应用程序不会终止。它只是挂在那里......

当我在 CLI 中查看 Hbase 输出时,我注意到了这一部分:

2015-10-20 15:01:53,207 INFO  [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Got user-level KeeperException when processing sessionid:0x150855715570000 type:create cxid:0xd57 zxid:0x62e txntype:-1 reqpath:n/a Error Path:/hbase/namespace/hbase Error:KeeperErrorCode = NodeExists for /hbase/namespace/hbase
2015-10-20 15:01:53,217 INFO  [Greg:52905.activeMasterManager] master.HMaster: Master has completed initialization

2015-10-20 15:01:53,220 INFO  [greg:52905.activeMasterManager] quotas.MasterQuotaManager: Quota support disabled
2015-10-20 15:02:10,001 INFO  [SessionTracker] server.ZooKeeperServer: Expiring session 0x1508540d00a0009, timeout of 40000ms exceeded
2015-10-20 15:02:10,002 INFO  [SessionTracker] server.ZooKeeperServer: Expiring session 0x1508540d00a0008, timeout of 40000ms exceeded
2015-10-20 15:02:10,005 INFO  [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x1508540d00a0009
2015-10-20 15:02:10,007 INFO  [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x1508540d00a0008
2015-10-20 15:06:48,610 INFO  [LruBlockCacheStatsExecutor] hfile.LruBlockCache: totalSize=1.67 MB, freeSize=1.58 GB, max=1.58 GB, blockCount=4, accesses=17, hits=13, hitRatio=76.47%, , cachingAccesses=17, cachingHits=13, cachingHitsRatio=76.47%, evictions=29, evicted=0, evictedPerRun=0.0
2015-10-20 15:06:58,791 INFO  [greg,52936,1445346099888_ChoreService_1] regionserver.HRegionServer: greg,52936,1445346099888-MemstoreFlusherChore requesting flush for region hbase:meta,,1.1588230740 after a delay of 20679
2015-10-20 15:07:08,790 INFO  [greg,52936,1445346099888_ChoreService_1] regionserver.HRegionServer: greg,52936,1445346099888-MemstoreFlusherChore requesting flush for region hbase:meta,,1.1588230740 after a delay of 6649
2015-10-20 15:07:18,790 INFO  [greg,52936,1445346099888_ChoreService_1] regionserver.HRegionServer: greg,52936,1445346099888-MemstoreFlusherChore requesting flush for region hbase:meta,,1.1588230740 after a delay of 18558
2015-10-20 15:07:19,481 INFO  [MemStoreFlusher.0] regionserver.HRegion: Started memstore flush for hbase:meta,,1.1588230740, current region memstore size 2.79 KB, and 1/1 column families' memstores are being flushed.
2015-10-20 15:07:19,643 INFO  [MemStoreFlusher.0] regionserver.DefaultStoreFlusher: Flushed, sequenceid=332, memsize=2.8 K, hasBloomFilter=false, into tmp file file:/C:/Users/greg/AppData/Local/Temp/hbase-greg/hbase/data/hbase/meta/1588230740/.tmp/edcebd7b3e8841de931094a5f97f7d1b
2015-10-20 15:07:19,702 INFO  [MemStoreFlusher.0] regionserver.HStore: Added file:/C:/Users/greg/AppData/Local/Temp/hbase-greg/hbase/data/hbase/meta/1588230740/info/edcebd7b3e8841de931094a5f97f7d1b, entries=12, sequenceid=332, filesize=6.0 K
2015-10-20 15:07:19,705 INFO  [MemStoreFlusher.0] regionserver.HRegion: Finished memstore flush of ~2.79 KB/2856, currentsize=0 B/0 for region hbase:meta,,1.1588230740 in 224ms, sequenceid=332, compaction requested=false
2015-10-20 15:11:48,609 INFO  [LruBlockCacheStatsExecutor] hfile.LruBlockCache: totalSize=1.67 MB, freeSize=1.58 GB, max=1.58 GB, blockCount=4, accesses=19, hits=15, hitRatio=78.95%, , cachingAccesses=19, cachingHits=15, cachingHitsRatio=78.95%, evictions=59, evicted=0, evictedPerRun=0.0

我在 Windows 和 JDK 1.8 上运行。 我的 hbase-site 配置为空。 我的应用程序的类路径如下:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-configuration-1.6.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-lang-2.6.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-logging-1.2.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/log4j-1.2.17.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/protobuf-java-2.5.0.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/slf4j-api-1.7.7.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/slf4j-log4j12-1.7.5.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/zookeeper-3.4.6.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hadoop-client-2.5.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hadoop-common-2.5.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hbase-client-1.1.2.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hbase-common-1.1.2.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/guava-12.0.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-collections-3.2.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hadoop-hdfs-2.5.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hadoop-auth-2.5.1.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hbase-annotations-1.1.2.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/hbase-protocol-1.1.2.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/htrace-core-3.1.0-incubating.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-io-2.4.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/netty-all-4.0.23.Final.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/hbase-1.1.2-bin/lib/commons-codec-1.9.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/tika-core-1.5.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/tika-parsers-1.5.jar"/>
    <classpathentry kind="lib" path="C:/Users/Greg/Documents/Tools/pdfbox-app-1.8.10.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

如何解决这个问题并让 HBase 再次响应? 感谢您的帮助。


编辑

我尝试删除 C:\Users\greg\AppData\Local\Temp 中的 tmp 数据 以及我项目中的 datazookeeper 文件夹,现在 Hbase 甚至无法启动。

2015-10-20 15:51:27,022 INFO  [RS:0;greg:54045-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2015-10-20 15:51:27,213 INFO  [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2015-10-20 15:51:28,026 WARN  [RS:0;greg:54045-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Session 0x150858481600003 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-10-20 15:51:28,217 WARN  [main-SendThread(127.0.0.1:2181)] zookeeper.ClientCnxn: Session 0x150858481600001 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

【问题讨论】:

  • 您是否妥善处理了您的桌子?你在重复使用你的连接吗?
  • 这个命令在我的函数的最开始。在这个“put”之后(这似乎不起作用),我关闭了我的连接
  • hbase 在 ZK 中维护信息。如果你核对了 ZK 数据,你将不得不重启 hbase。

标签: java hadoop hbase apache-zookeeper


【解决方案1】:

您的会话似乎以不一致的状态结束,在 ZooKeeper 中留下了一些元数据(这是您遇到的第一个错误),也许您可​​以通过使用 ZooKeeper client 自己清理 ZooKeeper 并清理那里的 HBase 条目并重新启动 HBase 来解决该错误.

但是现在你甚至无法启动 HBase,我建议download 并在同一地址 (127.0.0.1:2181) 启动你自己的 ZooKeeper 服务器并尝试再次启动 HBase。如果可行,则意味着您需要考虑正确修复 HBase ZooKeeper 连接。我对 HBase 不是很熟悉,但 this 可能是一个不错的起点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-11
    • 2016-08-29
    • 2017-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多