0

我正在使用 Spring Boot 创建一个 Web 服务,并希望将我的数据模型保存在 HBase 中。我想使用昆德拉来完成这项任务。但是,我无法让它工作。启动应用程序时,它会启动,冻结大约一分钟并超时。以下是我的一些配置片段:

我的persistence.xml:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">
    <persistence-unit name="hbase_pu">
        <provider>com.impetus.kundera.KunderaPersistence</provider>     
        <properties>            
            <property name="kundera.nodes" value="my-hbase-server.example.com"/>
            <property name="kundera.port" value="2181"/>
            <property name="kundera.keyspace" value="mykeyspace"/>
            <property name="kundera.dialect" value="hbase"/>
            <property name="kundera.client.lookup.class" value="com.impetus.client.hbase.HBaseClientFactory" />
            <property name="kundera.ddl.auto.prepare" value="update"/>             
        </properties>       
    </persistence-unit>
</persistence>

我对实体管理器的配置:

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
    return bean;
}

尝试运行它时,它似乎可以正常运行:

... many info outputs ...
2014-12-10 09:07:05.682  INFO 5194 --- [ost-startStop-1] org.apache.zookeeper.ZooKeeper           : Initiating client connection, connectString=my-hbase-server.example.com:2181 sessionTimeout=90000 watcher=hconnection-0x556effa0, quorum=my-hbase-server.example.com:2181, baseZNode=/hbase
2014-12-10 09:07:05.694  INFO 5194 --- [ne002.int:2181)] org.apache.zookeeper.ClientCnxn          : Opening socket connection to server my-hbase-server.example.com/x.x.x.x:2181. Will not attempt to authenticate using SASL (unknown error)
2014-12-10 09:07:05.698  INFO 5194 --- [ne002.int:2181)] org.apache.zookeeper.ClientCnxn          : Socket connection established to my-hbase-server.example.com/x.x.x.x:2181, initiating session
2014-12-10 09:07:05.780  INFO 5194 --- [ne002.int:2181)] org.apache.zookeeper.ClientCnxn          : Session establishment complete on server my-hbase-server.example.com/x.x.x.x:2181, sessionid = 0x14a2e04a4ca001f, negotiated timeout = 40000
2014-12-10 09:07:05.820  INFO 5194 --- [ost-startStop-1] o.a.h.hbase.client.ZooKeeperRegistry     : ClusterId read in ZooKeeper is null

然后,它冻结了大约一分钟,之后,它崩溃了:

2014-12-10 09:08:05.703 ERROR 5194 --- [ost-startStop-1] c.i.c.h.s.HBaseSchemaManager             : Either check for network connection or table isn't in enabled state, Caused by:
... large stack trace, interesting section: ...
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations
    at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:301)
    at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:131)
    at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:56)
    at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:179)
    at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:287)
    at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:267)
    at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:139)
    at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:134)
    at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:763)
    at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:185)
    at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:86)
    at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.isTableAvailable(ConnectionManager.java:919)
    at org.apache.hadoop.hbase.client.HBaseAdmin.isTableAvailable(HBaseAdmin.java:1127)
    at org.apache.hadoop.hbase.client.HBaseAdmin.isTableAvailable(HBaseAdmin.java:1135)
    at com.impetus.client.hbase.schemamanager.HBaseSchemaManager.update(HBaseSchemaManager.java:100)
    ... 165 more

这里出了什么问题?我错过了什么吗?如果有,是什么?

4

1 回答 1

0

原来它与 Zookeeper 有关。hbase 的入口点被硬编码为/hbase,而我的服务器的入口点不同。但是,唉,昆德拉似乎是不完整的,KunderaCriteriaQuery有很多// TODO Auto-generated method stubreturn null所以不幸的是它不能用于我的任务。

于 2014-12-10T09:34:37.400 回答