繁体   English   中英

Accumulo表扫描程序在Java中静默失败

[英]Accumulo table scanner failing silently in Java

我正在尝试使用Java API扫描整个Accumulo表。 我已经验证了元信息都是正确的(凭证,ZooKeeper服务器,Accumlo实例ID,表名)。 在这一点上,我处于死胡同,所以任何建议都值得赞赏。

Accumulo版本

1.6.2

编码

累积借来的客户中借来的。

// scan the whole table
System.out.println("=== whole table ===");
Scanner tableScanner;
try {
  tableScanner = conn.createScanner("geomesa3_records", new Authorizations());
  // conn is of type Connector
  // Connector and Scanner are implemented in org.apache.accumulo.core.client
  // See links below for additional info
} catch (TableNotFoundException ex) {
  throw new RuntimeException("table not found - was SimpleIngestClient run?");
}
System.out.println("-------------------------------------");

for(Map.Entry<Key, Value> kv : tableScanner) { // seemingly freezes here
  System.out.println("----------------- new row ---------------");
  System.out.println(kv.getKey().getRow() + " "
      + kv.getKey().getColumnFamily() + " "
      + kv.getKey().getColumnQualifier() + ": "
      + new String(kv.getValue().get()));
}
tableScanner.close();
System.out.println("-------------------------------------");
System.out.println("=== end table ===");

预期结果

=== whole table ===
-------------------------------------
----------------- new row ---------------
// table data
----------------- new row ---------------
// table data
----------------- new row ---------------
// table data
-------------------------------------
=== end table ===

实际结果

=== whole table ===
-------------------------------------

相关的Accumulo链接

Scanner API

用于createScanner Connector API

Scanner界面

我认为您可能需要在扫描仪上设置范围。 要扫描整个表格,只需设置范围如下:

scanner.setRange(new Range());

此范围将匹配所有内容。 具体地,该范围“从负无穷大到正无穷大”。 基本上,它匹配所有可能的键。

我使用类似的策略对我的一张桌子进行所有操作。

另外,请注意,这种事情肯定会引起问题。 如果表变大,则可能需要很长时间才能运行。 就我而言,我从不希望该表增长到几百个逻辑行以上,因此我认为它是安全的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM