hbase找不到现有的表

时间:2012-05-14 15:20:34

标签: hadoop hbase opentsdb

我设置了一个hbase集群来存储来自opentsdb的数据。最近由于重启了一些节点,hbase丢失了表“tsdb”。我仍然可以在hbase的主节点页面上,但是当我点击它时,它给了我一个tableNotFoundException

org.apache.hadoop.hbase.TableNotFoundException: tsdb
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:952)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:818)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:782)
    at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:249)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:213)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:171)
......

我输入了hbase shell,试图找到'tsdb'表,但得到了类似的消息

hbase(main):018:0> scan 'tsdb'
ROW                                                          COLUMN+CELL

ERROR: Unknown table tsdb!

但是当我尝试重新创建这个表时,hbase shell告诉我该表已经存在......

hbase(main):013:0> create 'tsdb', {NAME => 't', VERSIONS => 1, BLOOMFILTER=>'ROW'}

ERROR: Table already exists: tsdb!

我还可以列出hbase shell中的表

hbase(main):001:0> list
TABLE
tsdb
tsdb-uid
2 row(s) in 0.6730 seconds

看一下日志,我发现这应该是我的问题的原因

2012-05-14 12:06:22,140 WARN org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation: Encountered problems when prefetch META table:
org.apache.hadoop.hbase.TableNotFoundException: Cannot find row in .META. for table: tsdb, row=tsdb,,99999999999999
    at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:157)
    at org.apache.hadoop.hbase.client.MetaScanner.access$000(MetaScanner.java:52)
    at org.apache.hadoop.hbase.client.MetaScanner$1.connect(MetaScanner.java:130)
    at org.apache.hadoop.hbase.client.MetaScanner$1.connect(MetaScanner.java:127)

它说在.META中找不到tsbb行。但是.META确实有tsdb行。

hbase(main):002:0> scan '.META.'
ROW                                                          COLUMN+CELL
 tsdb,\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\ column=info:regioninfo, timestamp=1336311752799, value={NAME => 'tsdb,\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\x00\x02\x00\x00\x12\x00\x00\x03\x00\x00\x13\x00\x00\x
 x00\x02\x00\x00\x12\x00\x00\x03\x00\x00\x13\x00\x00\x05\x00 05\x00\x001,1336311752340.7cd0d2205d9ae5fcadf843972ec74ec5.', STARTKEY => '\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\x00\x02\x00\x00\x12\x00\x00\x03\x00\x00\x13\x00\
 \x001,1336311752340.7cd0d2205d9ae5fcadf843972ec74ec5.       x00\x05\x00\x001', ENDKEY => '\x00\x00\x10O\xA3\x8C\x80\x00\x00\x01\x00\x00\x0B\x00\x00\x02\x00\x00\x19\x00\x00\x03\x00\x00\x1A\x00\x00\x05\x00\x001', ENCODED => 7cd0d2205d9ae5f
                                                             cadf843972ec74ec5,}
 tsdb,\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\ column=info:server, timestamp=1337011527000, value=brycobapd01.usnycbt.amrs.bankofamerica.com:60020
 x00\x02\x00\x00\x12\x00\x00\x03\x00\x00\x13\x00\x00\x05\x00
 \x001,1336311752340.7cd0d2205d9ae5fcadf843972ec74ec5.
 tsdb,\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\ column=info:serverstartcode, timestamp=1337011527000, value=1337011518948
......

 tsdb-uid,,1336081042372.a30d8074431c6a31c6a0a30e61fedefa.   column=info:server, timestamp=1337011527458, value=bry200163111d.usnycbt.amrs.bankofamerica.com:60020
 tsdb-uid,,1336081042372.a30d8074431c6a31c6a0a30e61fedefa.   column=info:serverstartcode, timestamp=1337011527458, value=1337011519807
6 row(s) in 0.2950 seconds

这是我在群集上运行“hbck”后的结果

ERROR: Region hdfs://slave-node-1:9000/hbase/tsdb/249438af5657bf1881a837c23997747e on HDFS, but not listed in META or deployed on any region server
ERROR: Region hdfs://slave-node-1:9000/hbase/tsdb/4f8c65fb72910870690b94848879db1c on HDFS, but not listed in META or deployed on any region server
ERROR: Region hdfs://slave-node-1:9000/hbase/tsdb/63276708b4ac9f11e241aca8b56e9def on HDFS, but not listed in META or deployed on any region server
ERROR: Region hdfs://slave-node-1:9000/hbase/tsdb/e54ee4def67d7f3b6dba75a3430e0544 on HDFS, but not listed in META or deployed on any region server
ERROR: (region tsdb,\x00\x00\x0FO\xA2\xF1\xD0\x00\x00\x01\x00\x00\x0E\x00\x00\x02\x00\x00\x12\x00\x00\x03\x00\x00\x13\x00\x00\x05\x00\x001,1336311752340.7cd0d2205d9ae5fcadf843972ec74ec5.) First region should start with an empty key.  You need to  create a new region and regioninfo in HDFS to plug the hole.
ERROR: Found inconsistency in table tsdb
Summary:
  -ROOT- is okay.
    Number of regions: 1
    Deployed on:  master-node,60020,1337011518948
  .META. is okay.
    Number of regions: 1
    Deployed on:  slave-node-2,60020,1337011519845
Table tsdb is inconsistent.
    Number of regions: 5
    Deployed on:  slave-node-2,60020,1337011519845 slave-node-1,60020,1337011519807 master-node,60020,1337011518948
  tsdb-uid is okay.
    Number of regions: 1
    Deployed on:  slave-node-1,60020,1337011519807
5 inconsistencies detected.
Status: INCONSISTENT

我跑了

bin/hbase hbck -fix

,遗憾的是无法解决我的问题

有人可以帮我解决这个问题吗

  1. 是否可以恢复此表“tsdb”?
  2. 如果1无法完成,是否建议优雅地删除'tsdb',并创建一个新的?
  3. 如果有人能让我知道重新启动节点的最佳方法是什么,我将不胜感激?目前,我将离开我的主节点。对于其他节点,我在重启后立即运行此命令。
  4. 命令:

    # start data node
    bin/hadoop-daemon.sh start datanode
    bin/hadoop-daemon.sh start jobtracker    
    # start hbase
    bin/hbase-daemon.sh start zookeeper
    bin/hbase-daemon.sh start regionserver 
    

    非常感谢!

10 个答案:

答案 0 :(得分:8)

有点晚了,也许对搜索者有帮助。

  1. 运行ZooKeeper shell hbase zkcli
  2. 在shell中运行ls /hbase/table
  3. 运行rmr /hbase/table/TABLE_NAME
  4. 重新启动Hbase

答案 1 :(得分:2)

我不太清楚为什么你无法扫描它。但是,要重新创建表,您可以尝试:

1)手动删除此表的.META表中的所有条目,并

2)从HDFS中删除该表对应的目录

在此之后尝试再次创建表格。

答案 2 :(得分:2)

如果你使用的是cdh4.3,那么zookeeper中的路径应该是/ hbase / table94 /

答案 3 :(得分:1)

要扩展@Devin拜耳的答案,请运行:

AttributeError: 'module' object has no attribute 'heappush'.

如果您发现由zookeeper维护任何僵尸表。有关此问题的更多帮助,您应该google&#39; HBase zombie tables&#39;。

答案 4 :(得分:1)

尝试修复meta

  1. hbase hbck
  2. hbase hbck -fixMeta
  3. hbase hbck -fixAssignments
  4. hbase hbck -fixReferenceFiles
  5. 之后再试一次

答案 5 :(得分:0)

有关删除表格的更多说明:

~/hbase-0.94.12/bin/hbase shell

> truncate 'tsdb'
> truncate 'tsdb-meta'
> truncate 'tsdb-uid'
> truncate 'tsdb-tree'
> exit

我还必须重启tsd守护进程。

答案 6 :(得分:0)

当我在没有TCP权限访问HBase机器的机器上从Java客户端尝试HBase连接时,我收到类似的错误消息。 当我在HBase机器上运行hbase shell时,表确实存在。

opentsdb是否具有访问HBase机器的所有权限/端口配置?

答案 7 :(得分:0)

我确实在工作场所面对这些问题。我通常要么删除znodes并删除相应的表,要么重启hbase HMaster和Hregionserver以获得hbck状态OK。

答案 8 :(得分:0)

从zookeeper路径中删除指定的表就足够了。 例如,如果 zookeeper.znode.parent 在hbase-site.xml中配置为 blob ,则应在zookeeper中启动 zkCli.sh 服务器shell并通过 rmr /blob/table/tsdb 命令删除该目录。

答案 9 :(得分:0)

hbase-clean.sh --cleanZk

效果很好,很简单。