有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么我不能连接到作为Docker容器运行的HBase?

我有我的JavaSpring应用程序,它处理HBase

以下是我的配置:

@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) 个答案