gpt4 book ai didi

java - 无法从本地 IDE 连接到 docker hbase

转载 作者:可可西里 更新时间:2023-11-01 15:49:33 26 4
gpt4 key购买 nike

我有一台 docker 机器,ip 为 10.101.48.150。使用下一个 docker-compose.yml 的独立 hbase 在哪里:

version: "3"

services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop2.7.4-java8
container_name: namenode
volumes:
- hadoop_namenode:/hadoop/dfs/name
networks:
hbasenetwork:
aliases:
- namenode
environment:
- CLUSTER_NAME=test
env_file:
- ./hadoop.env

datanode:
image: bde2020/hadoop-datanode:2.0.0-hadoop2.7.4-java8
container_name: datanode
volumes:
- hadoop_datanode:/hadoop/dfs/data
networks:
hbasenetwork:
aliases:
- datanode
environment:
SERVICE_PRECONDITION: "namenode:50070"
env_file:
- ./hadoop.env

resourcemanager:
image: bde2020/hadoop-resourcemanager:2.0.0-hadoop2.7.4-java8
container_name: resourcemanager
networks:
hbasenetwork:
aliases:
- resourcemanager
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075"
env_file:
- ./hadoop.env

nodemanager1:
image: bde2020/hadoop-nodemanager:latest
container_name: nodemanager
networks:
hbasenetwork:
aliases:
- nodemanager1
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075 resourcemanager:8088"
env_file:
- ./hadoop.env

historyserver:
image: bde2020/hadoop-historyserver:2.0.0-hadoop2.7.4-java8
container_name: historyserver
volumes:
- hadoop_historyserver:/hadoop/yarn/timeline.
networks:
hbasenetwork:
aliases:
- historyserver
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075 resourcemanager:8088"
env_file:
- ./hadoop.env

hbase:
image: bde2020/hbase-standalone:latest
container_name: hbase
volumes:
- hbase_data:/hbase-data
- hbase_zookeeper_data:/zookeeper-data
ports:
- 16000:16000
- 16010:16010
- 16020:16020
- 16030:16030
- 2888:2888
- 3888:3888
- 2182:2181
hostname: hbase
networks:
hbasenetwork:
aliases:
- hbase
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075"
env_file:
- ./hbase-standalone.env

volumes:
hadoop_namenode:
hadoop_datanode:
hadoop_historyserver:
hbase_data:
hbase_zookeeper_data:
networks:
hbasenetwork:
driver: bridge

我的java代码:

HBaseAdmin.checkHBaseAvailable(config);

我的配置是:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>10.101.48.150</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2182</value>
</property>
</configuration>

当我尝试从我的 java 中使用它时,我看到了下一条消息:

running.java.net.UnknownHostException: hbase

我明白我的 java 使用 10.101.48.150:2082 从 docker hbase 容器请求什么,响应 smt 并返回地址作为“hbase”,我的本地网络对任何“hbase”和故障一无所知。我尝试在主机文件中添加一行 10.101.48.150 hbase,但随后我看到下一个错误:

java.net.ConnectException: Connection refused: no further information

我不明白如何将我的本地 IDE 与 Hbase 容器连接。

最佳答案

在 docker-compose 中的 hbase 服务上,您确实映射了那些端口:

ports:
- 16000:16000
- 16010:16010
- 16020:16020
- 16030:16030
- 2888:2888
- 3888:3888
- 2182:2181

端口 2082 没有端口映射,因此您的应用程序无法成功连接到它。

关于java - 无法从本地 IDE 连接到 docker hbase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51522346/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com