Docker上的Hadoop无法访问站点

时间:2018-11-16 16:19:21

标签: docker hadoop

我尝试在Windows 10系列上将Hadoop与Docker Toolbox一起使用。因此,我按照以下设置进行操作:https://linoxide.com/cluster/setup-single-node-hadoop-cluster-docker/

  1. 下载图像->确定。
  2. 运行容器->确定。
$ docker run -it sequenceiq/hadoop-docker:2.7.1 /etc/bootstrap.sh -bash/
Starting sshd:                                             [  OK  ]
18/11/16 10:38:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [c13feb9767ac]
c13feb9767ac: starting namenode, logging to /usr/local/hadoop/logs/hadoop-root-namenode-c13feb9767ac.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-root- datanode-c13feb9767ac.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-root-secondarynamenode-c13feb9767ac.out
18/11/16 10:40:34 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn--resourcemanager-c13feb9767ac.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-root-nodemanager-c13feb9767ac.out
  1. 运行jps命令->确定。
bash-4.1# jps
119 NameNode
535 ResourceManager
200 DataNode
656 Jps
319 SecondaryNameNode
620 NodeManager
  1. 获取IP地址->确定。
bash-4.1# ifconfig
...
inet addr:172.17.0.2
...
  1. 转到浏览器(Google Chrome v70)-> KO。

使用的地址:172.17.0.2:50070

错误:

  

此网站无法访问172.17.0.2花了很长时间才回答。

您能帮我修复它吗?如果您需要更多信息,请问我。

谢谢。

更新1:

docker ps结果:

c13feb9767ac      sequenceiq/hadoop-docker:2.7.1   "/etc/bootstrap.sh -…"   20 minutes ago      Up 20 minutes       2122/tcp, 8030-8033/tcp, 8040/tcp, 8042/tcp, 8088/tcp, 19888/tcp, 49707/tcp, 50010/tcp, 50020/tcp, 50070/tcp, 50075/tcp, 50090/tcp   xenodochial_euclid

更新2:

我在防火墙上打开了端口50070,但问题仍然存在。

1 个答案:

答案 0 :(得分:1)

至少,您需要暴露端口。

docker run -it -p 50070:50070 sequenceiq/hadoop-docker:2.7.1

然后,如果您想继续使用旧的Docker工具箱(该链接文章创建于2016年,在Docker for Windows出现之前),则无需使用ifconfig,而应使用{{1} },而不是Windows


我个人使用Docker Compose

docker-machine ip

hadoop.env

version: "2"

services:
  namenode:
    image: bde2020/hadoop-namenode:1.1.0-hadoop2.7.1-java8
    container_name: namenode
    ports:
      - 8020:8020
      - 50070:50070
      # - 59050:59050
    volumes:
      - hadoop_namenode:/hadoop/dfs/name
    environment:
      - CLUSTER_NAME=test
    env_file:
      - ./hadoop.env
    networks:
      - hadoop

  datanode1:
    image: bde2020/hadoop-datanode:1.1.0-hadoop2.7.1-java8
    container_name: datanode1
    ports:
      - 50075:50075
    depends_on:
      - namenode
    volumes:
      - hadoop_datanode1:/hadoop/dfs/data
    env_file:
      - ./hadoop.env
    networks:
      - hadoop

volumes:
  hadoop_namenode:
  hadoop_datanode1:

networks:
  hadoop: