Spring Data モジュールの HbaseTemplate を使用して、zookeeper 経由で HBase クラスターに接続しようとしています。セッションの確立は正常に行われますが、find メソッドが値を返すことはありません。それは永遠にそこにぶら下がっています。
構成ファイルとテストケースを添付しています。どんな助けでも大歓迎です。
春の設定:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:hdp="http://www.springframework.org/schema/hadoop" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop-1.0.xsd">
<bean id="hbaseTemplate" class="org.springframework.data.hadoop.hbase.HbaseTemplate"
p:configuration-ref="hbaseConfiguration" />
<hdp:configuration>
</hdp:configuration>
<hdp:hbase-configuration zk-quorum="hadoop-host-2" zk-port="2181" delete-connection="true">
</hdp:hbase-configuration>
</beans>
Junit テスト クラス:
import java.util.List;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.hadoop.hbase.HbaseTemplate;
import org.springframework.data.hadoop.hbase.RowMapper;
import org.springframework.data.hadoop.hbase.TableCallback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/hbase/hbase-config.xml")
public class HBaseConnectionTest {
@Autowired
private HbaseTemplate hbaseTemplate;
@Test
public void testConnection() {
List<String> list = hbaseTemplate.find("testTab",
"testcf:testCol", new RowMapper<String>() {
@Override
public String mapRow(Result result, int arg1)
throws Exception {
return result.toString();
}
});
System.out.println(list);
}
出力:
INFO : org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper - このプロセスの識別子は 8916@WINDOWS-8KV8O4B です INFO : org.apache.zookeeper.client.ZooKeeperSaslClient - デフォルトの JAAS 構成セクションが「クライアント」が見つかりませんでした。SASL を使用していない場合は、これを無視してかまいません。一方、SASL が機能することを期待していた場合は、JAAS 構成を修正してください。INFO : org.apache.zookeeper.ClientCnxn - iaps-hadoop-host-2/192.168.111.242:2181 へのソケット接続が確立され、セッションが開始されました INFO : org.apache.zookeeper.ClientCnxn - サーバー hadoop-host-2 でセッションの確立が完了しました/192.168.111.242:2181、セッション ID = 0x13c8bcf1cd7000a、ネゴシエートされたタイムアウト = 60000