在宿主机如何访问docker中hadoop的hdfs:ip:9000啊, 端口映射出来啊
巴扎黑
巴扎黑 2017-04-25 09:01:31
0
1
1180

本人有一个3节点hadoop, 启动了3个docker容器, 众所周知, docker容器内服务的端口是可以映射到宿主机的端口的, 我采用-P将容器的所有端口映射到主机端口, 命令如下:

docker run -it -v /Users/yc/hadoop/docker:/test -P -h h1 --name h1 sequenceiq/hadoop-docker /etc/bootstrap.sh -bash

这是第master节点的启动脚本, 映射了一个宿主机目录, 映射了所有容器端口到宿主机, 而且设置了容器的hostname
当我查看进程的时候

docker ps

结果如下, 我做了下美化:

b96b897c6532        sequenceiq/hadoop-docker   "/etc/bootstrap.sh -b"   
24 minutes ago      Up 24 minutes       
0.0.0.0:32797->2122/tcp, 
0.0.0.0:32796->8030/tcp, 
0.0.0.0:32795->8031/tcp, 
0.0.0.0:32794->8032/tcp, 
0.0.0.0:32793->8033/tcp, 
0.0.0.0:32792->8040/tcp, 
0.0.0.0:32791->8042/tcp, 
0.0.0.0:32790->8088/tcp, 
0.0.0.0:32789->19888/tcp, 
0.0.0.0:32788->49707/tcp, 
0.0.0.0:32787->50010/tcp, 
0.0.0.0:32786->50020/tcp, 
0.0.0.0:32785->50070/tcp, 
0.0.0.0:32784->50075/tcp, 
0.0.0.0:32783->50090/tcp   
h1

我们常用的50070和8088都映射出来了, 但是9000没有, 我知道9000这个协议是hdfs, 可能不属于tcp, 那么如何在我宿主机访问啊
我想用IDEA开发hadoop的java程序, 输入输出目录都得是 hdfs:ip:9000/目录 这种形式的, 不知道如何访问docker容器的该端口啊

巴扎黑
巴扎黑

reply all(1)
習慣沉默

The lack of HDFS ipc port is a bug of the sequenceiq/hadoop-docker image sequenceiq/hadoop-docker#48. Although it has been fixed (see: https://github.com/sequenceiq..., its maintainer has not built a new version of the image, As a result, you still have problems using it now

.

The solution is simple, just docker run 后面的参数上手动加上 -p 9000:9000.

By the way, although the Hadoop website mentions sequenceiq/hadoop-docker 这个 docker 镜像,但是从其 Dockerfile 的撰写情况看,其作者对 Docker 理解很肤浅,并没有遵循Docker官方的Dockerfile this docker image, judging from the writing of its Dockerfile, its author has a superficial understanding of Docker and does not follow Docker's official Dockerfile Best practice guidelines, the image is very bloated and not well made. If you have the ability, you should follow the official best practice guidelines to customize the image you need.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!