WARN会话0x0,用于服务器null,意外错误,关闭套接字连接并尝试重新连接

时间:2019-02-16 14:06:22

标签: java docker apache-zookeeper mesos marathon

我有两个节点,每个节点上都安装了具有Mesos,马拉松和Zookeeper的docker。这是我在主节点上的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组成的从节点:

 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 |在sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)

     

marathon_1 |在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]信息正在打开到服务器的套接字连接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]为服务器null,意外错误,关闭套接字连接并尝试重新连接而警告会话0x0(org.apache.zookeeper.ClientCnxn:main-SendThread(172.28.10.133:2190))      

marathon_1 | java.net.ConnectException:连接被拒绝   marathon_1 |在sun.nio.ch.SocketChannelImpl.checkConnect(本机方法)

     

marathon_1 |在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:main)

我不知道会发生什么。我尝试使用 ufw 打开每个端口,或者我禁用了防火墙,但是错误并没有消失。您能告诉我docker compose文件怎么了吗?

任何帮助将不胜感激。

谢谢。

2 个答案:

答案 0 :(得分:0)

我刚刚重新启动了“ zookeeper”,一切正常。

./ZOOKEEPER_HOME/bin/zkServer.sh restart

答案 1 :(得分:0)

“服务器为空” 表示在运行ZK CLI时未收到服务器参数的值。
查看是否可以通过在命令行中传递配置文件中指定的内容来覆盖Zookeeper服务器和端口。
./ zkCli.sh-服务器主机名:端口