我不确定这是否是 100% 编程或系统管理员相关问题。
我正在尝试在版本 3 中为 docker-swarm、docker 版本 1.13 设置一个 docker-compose 文件,以测试我本地工作流程的 spark。
遗憾的是,端口 7077 仅绑定(bind)到我的 swarm 集群上的 localhost,因此无法从外部世界访问,我的 spark 应用程序正在尝试连接到它。
有谁知道,如何让 docker-compose 在 swarm 模式下绑定(bind)到所有接口(interface)?
我发布了我的端口,这适用于 8080,但不适用于 7070。
nmap输出:
Starting Nmap 7.01 ( https://nmap.org ) at 2017-03-02 11:27 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000096s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
8080/tcp open http-proxy
8081/tcp open blackice-icecap
8888/tcp open sun-answerbook
端口说明
8081 is my spark worker
8080 is my spark master frontend
8888 is the spark hue frontend
nmap 未列出 7077
使用网络统计:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1641/sshd
tcp6 0 0 :::4040 :::* LISTEN 1634/dockerd
tcp6 0 0 :::2377 :::* LISTEN 1634/dockerd
tcp6 0 0 :::7946 :::* LISTEN 1634/dockerd
tcp6 0 0 :::80 :::* LISTEN 1634/dockerd
tcp6 0 0 :::8080 :::* LISTEN 1634/dockerd
tcp6 0 0 :::8081 :::* LISTEN 1634/dockerd
tcp6 0 0 :::6066 :::* LISTEN 1634/dockerd
tcp6 0 0 :::22 :::* LISTEN 1641/sshd
tcp6 0 0 :::8888 :::* LISTEN 1634/dockerd
tcp6 0 0 :::443 :::* LISTEN 1634/dockerd
tcp6 0 0 :::7077 :::* LISTEN 1634/dockerd
我可以通过 localhost 上的 telnet 连接到 7077,没有任何问题,但是在 localhost 之外,我收到了连接被拒绝的错误。
在这个时间点(请耐心等待,我不是系统管理员,我是软件专家),我开始觉得这与 docker 网状网络有某种关系。
Docker compose 部分用于我的主配置:
#the spark master, having to run on the frontend of the cluster
master:
image: eros.fiehnlab.ucdavis.edu/spark
command: bin/spark-class org.apache.spark.deploy.master.Master -h master
hostname: master
environment:
MASTER: spark://master:7077
SPARK_CONF_DIR: /conf
SPARK_PUBLIC_DNS: blonde.fiehnlab.ucdavis.edu
ports:
- 4040:4040
- 6066:6066
- 8080:8080
- 7077:7077
volumes:
- /tmp:/tmp/data
networks:
- spark
- frontends
deploy:
placement:
#only run on manager node
constraints:
- node.role == manager
网络 spark 和 frontend 都是覆盖网络
最佳答案
问题是 docker-compose 文件中的配置错误。原始配置中的 -h master 始终绑定(bind)到本地主机接口(interface)。
即使在指定了 SPARK_LOCAL_IP 值之后
master:
image: eros.fiehnlab.ucdavis.edu/spark:latest
command: bin/spark-class org.apache.spark.deploy.master.Master
hostname: master
environment:
SPARK_CONF_DIR: /conf
SPARK_PUBLIC_DNS: blonde.fiehnlab.ucdavis.edu
SPARK_LOCAL_IP: 0.0.0.0
ports:
- 4040:4040
- 6066:6066
- 8080:8080
- 7077:7077
volumes:
- /tmp:/tmp/data
deploy:
placement:
#only run on manager node
constraints:
- node.role == manager
关于apache-spark - docker-compose v3 + apache spark,端口 7077 上的连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42564414/