我有一台ip为10.101.48.150的docker机器。使用next 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要求docker hbase容器使用10.101.48.150:2082,响应smt并返回地址为“hbase”,我的本地网络不知道任何“hbase”和故障。我尝试向hosts文件添加一行10.101.48.150 hbase,但随后我看到下一个错误:
java.net.ConnectException: Connection refused: no further information
我不明白如何将本地ide与hbase容器连接起来。
1条答案
按热度按时间yk9xbfzb1#
在你的
hbase
docker compose中的服务您确实Map了这些端口:端口2082没有端口Map,因此应用程序无法成功连接到它。