警告服务器空会话 0x0,意外错误,关闭套接字连接并尝试重新连接

WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

我有两个节点,每个节点都有 docker,上面安装了 Mesos、marathon 和 zookeeper。这是我在主节点上的 docker 撰写文件:

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。但是当我 运行 docker 在主节点 (150.20.11.133) 上编写时,我得到了这个错误:

marathon_1 | java.net.ConnectException: Connection refused marathon_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

marathon_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) marathon_1 | at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

marathon_1 | at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1144) marathon_1 | [2019-02-16 13:38:14,087] INFO Opening socket connection to server 172.28.10.133/172.28.10.133:2190. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn:main-SendThread(172.28.10.133:2190))

marathon_1 | [2019-02-16 13:38:14,087] WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn:main-SendThread(172.28.10.133:2190))

marathon_1 | java.net.ConnectException: Connection refused marathon_1 | at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

marathon_1 | at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

marathon_1 | at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

marathon_1 | at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1144) marathon_1 | [2019-02-16 13:38:14,173] ERROR Failed to connect to ZK. Marathon will exit now. (mesosphere.marathon.core.storage.store.impl.zk.RichCuratorFramework:main)

我不知道发生了什么。我尝试用 ufw 打开每个端口,或者我禁用了防火墙,但错误并没有消失。你能告诉我 docker 撰写文件有什么问题吗?

如有任何帮助,我们将不胜感激。

谢谢。

我刚重启 "zookeeper" 一切正常。

./ZOOKEEPER_HOME/bin/zkServer.sh restart

"server null" 表示在 运行 您的 ZK CLI 时没有收到服务器参数的值。
查看您是否可以通过命令行传递配置文件中指定的内容来覆盖您的 zookeeper 服务器和端口。
./zkCli.sh -server hostname:port