为什么我无法连接到以Docker容器运行的HBase?

时间:2019-01-28 01:05:40

标签: java spring docker hbase

我有处理HBase的Java Spring应用程序。

这是我的配置:

@Configuration
public class HbaseConfiguration {

    @Bean
    public HbaseTemplate hbaseTemplate(@Value("${hadoop.home.dir}") final String hadoopHome,
                                       @Value("${hbase.zookeeper.quorum}") final String quorum,
                                       @Value("${hbase.zookeeper.property.clientPort}") final String port)
            throws IOException, ServiceException {
        System.setProperty("hadoop.home.dir", hadoopHome);
        org.apache.hadoop.conf.Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.quorum", quorum);
        configuration.set("hbase.zookeeper.property.clientPort", port);
        HBaseAdmin.checkHBaseAvailable(configuration);
        return new HbaseTemplate(configuration);
    }

}

#HBASE
hbase.zookeeper.quorum = localhost
hbase.zookeeper.property.clientPort = 2181
hadoop.home.dir = C:/hadoop

在问问题之前,我试图自己找出问题,并找到此链接https://github.com/sel-fish/hbase.docker

但是,仍然出现错误

org.apache.hadoop.net.ConnectTimeoutException: 10000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.SocketChannel[connection-pending remote=myhbase/192.168.99.100:60000]

我能否请您帮忙,并阐明如何将本地Java应用程序与在Docker中运行的HBase连接起来?

0 个答案:

没有答案