我有两个节点,每个节点都有Docker,其上安装了Mesos,marathon和zookeeper。这是主节点上的docker compose文件:
version: '3.7'
services:
zookeeper:
image: ubuntu_mesos_home_marzieh
command: /home/zookeeper-3.4.8/bin/zkServer.sh restart
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 2190
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 10
ZOOKEEPER_SYNC_LIMIT: 5
ZOOKEEPER_SERVERS: 150.20.11.133:2888:3888;150.20.11.136:2888:3888
network_mode: host
expose:
- 2190
- 2888
- 3888
ports:
- 2190:2190
- 2888:2888
- 3888:3888
master-mesos:
image: ubuntu_mesos_home_marzieh
command: bash -c "sleep 30; /home/mesos-1.7.0/build/bin/mesos-
master.sh --ip=150.20.11.133 --work_dir=/var/run/mesos
--hostname=150.20.11.133"
privileged: true
restart: always
network_mode: host
depends_on:
- zookeeper
environment:
- LIBPROCESS_IP=150.20.11.133
- MESOS_HOSTNAME="150.20.11.133"
- MESOS_QUORUM=1
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_WORK_DIR=/var/run/mesos
expose:
- 5050
- 4040
- 7077
- 8080
ports:
- 5050:5050
- 4040:4040
- 7077:7077
- 8080:8080
marathon:
image: ubuntu_mesos_home_marzieh
command: bash -c "sleep 60; /usr/share/marathon/bin/marathon"
privileged: true
network_mode: host
depends_on:
- zookeeper
- master-mesos
environment:
- HOSTNAME="150.20.11.133"
- MARATHON_ZK=zk://150.20.11.133:2190/marathon
- MARATHON_MASTER=zk://150.20.11.133:2190/mesos
- MESOS_NATIVE_JAVA_LIBRARY=/usr/local/lib/libmesos.so
- MARATHON_HTTP_PORT=8080
expose:
- 8080
- 2190
ports:
- 8080:8080
- 2190:2190
这是docker compie for slave node:
version: '3.7'
services:
zookeeper:
image: ubuntu_mesos_home_marzieh
command: /home/zookeeper-3.4.8/bin/zkServer.sh start
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 2190
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 10
ZOOKEEPER_SYNC_LIMIT: 5
ZOOKEEPER_SERVERS:
150.20.11.133:2888:3888;150.20.11.136:2888:3888
network_mode: host
expose:
- 2190
- 2888
- 3888
ports:
- 2190:2190
- 2888:2888
- 3888:3888
slave-mesos:
image: ubuntu_mesos_home_marzieh
command: bash -c "sleep 40; /home/mesos-1.7.0/build/bin/mesos-
slave.sh --master=150.20.11.133:5050 --work_dir=/var/run/mesos
--systemd_enable_support=false"
privileged: true
restart: always
privileged: true
network_mode: host
depends_on:
- zookeeper
environment:
- MESOS_RESOURCES=ports(*):[11000-11999]
- LIBPROCESS_IP=150.20.11.136
- MESOS_HOSTNAME="150.20.11.136"
- MESOS_EXECUTOR_REGISTRATION_TIMEOUT=5mins
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_WORK_DIR=/var/run/mesos
- MESOS_LOGGING_LEVEL=INFO
expose:
- 5051
ports:
- 5051:5051
marathon:
image: ubuntu_mesos_home_marzieh
command: bash -c "sleep 60; /usr/share/marathon/bin/marathon"
privileged: true
network_mode: host
depends_on:
- zookeeper
- slave-mesos
environment:
- MARATHON_ZK=zk://150.20.11.133:2190/marathon
- MARATHON_MASTER=zk://150.20.11.133:2190/mesos
- MESOS_NATIVE_JAVA_LIBRARY=/usr/local/lib/libmesos.so
- MARATHON_HTTP_PORT=8080
expose:
- 8080
- 2190
ports:
- 8080:8080
- 2190:2190
我在“zoo.cfg”上配置了Zookeeper,并为每个节点创建了“myid”文件。我还配置了Mesos和Marathon。但是当我在主节点(150.20.11.133)上运行docker compose时,我收到了这个错误:
marathon_1 | java.net.ConnectException:连接被拒绝marathon_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
marathon_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)marathon_1 |在org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
marathon_1 |在org.apache.zookeeper.ClientCnxn $ SendThread.run(ClientCnxn.java:1144)marathon_1 | [2019-02-16 13:38:14,087] INFO打开与服务器172.28.10.133/172.28.10.133:2190的套接字连接。不会尝试使用SASL进行身份验证(未知错误)(org.apache.zookeeper.ClientCnxn:main-SendThread(172.28.10.133:2190))
marathon_1 | [2019-02-16 13:38:14,087] WARN会话0x0服务器空,意外错误,关闭套接字连接并尝试重新连接(org.apache.zookeeper.ClientCnxn:main-SendThread(172.28.10.133:2190))
marathon_1 | java.net.ConnectException:连接被拒绝marathon_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
marathon_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
marathon_1 |在org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
marathon_1 |在org.apache.zookeeper.ClientCnxn $ SendThread.run(ClientCnxn.java:1144)marathon_1 | [2019-02-16 13:38:14,173]错误无法连接到ZK。马拉松现在将退出。 (mesosphere.marathon.core.storage.store.impl.zk.RichCuratorFramework:主)
我不知道发生了什么。我尝试用ufw打开每个端口,或者我禁用防火墙,但错误没有消失。你能告诉我docker compose文件有什么问题吗?
任何帮助,将不胜感激。
谢谢。
我刚刚重启“zookeeper”,一切都很顺利。
./ZOOKEEPER_HOME/bin/zkServer.sh restart
“server null”表示在运行ZK CLI时没有收到服务器参数的值。 查看是否可以通过命令行传递配置文件中指定的内容来覆盖zookeeper服务器和端口。 ./zkCli.sh -server hostname:port