2

我目前有一个docker-compose.yml文件,它带来了许多服务。其中一个服务是 pulsar,另一个是通过 websocket 连接的网络服务器。当我启动这些服务时,websocket 容器不起作用。它的日志说:Error Checking/Getting Partition Metadata while Subscribing on persistent://public/default/test。我没有使用分区,所以我很难弄清楚这一点。

到目前为止,我已经做了很多谷歌搜索,发现这个问题没有答案,但看起来与我的问题相似。

这是我的docker-compose.yml文件:

version: '3.2'

services:
  pulsar:
    image: apachepulsar/pulsar:latest
    command: bin/pulsar standalone
    ports:
      - "6650"
      - "8080"

  ios_pos_ws_input:
    depends_on:
      - pulsar
    environment:
      - PULSAR_HOST=pulsar
    image: dock.gastrofix.com/bridge/ios_pos_ws_input:${VERSION:-latest}
    restart: always
    ports:
      - "8765"
    command: python3 -m wait_for_pulsar "python3 -m inputs.ios_pos.web_sockets.ws_server"

  ios_pos_ws_sink:
    depends_on:
      - pulsar
    environment:
      - PULSAR_HOST=pulsar
    image: dock.gastrofix.com/bridge/ios_pos_ws_sink:${VERSION:-latest}
    restart: always
    ports:
      - "8765"
    command: python3 -m wait_for_pulsar "python3 -m sinks.ios_pos_ws"

volumes:
  pulsar:

当我检查两者的日志时ios_pos_ws_inputios_pos_ws_sink我看到了:

2019-05-15 14:12:52.809 INFO  ClientConnection:300 | [172.28.0.5:53624 -> 172.28.0.2:6650] Connected to broker
2019-05-15 14:12:52.920 ERROR ClientConnection:726 | [172.28.0.5:53624 -> 172.28.0.2:6650] Failed partition-metadata lookup req_id: 1 error: 1
2019-05-15 14:12:52.920 ERROR ClientImpl:394 | Error Checking/Getting Partition Metadata while Subscribing on persistent://public/default/test -- 5
2019-05-15 14:12:52.921 INFO  ClientImpl:492 | Closing Pulsar client
2019-05-15 14:12:54.922 INFO  Client:88 | Subscribing on Topic :test
2019-05-15 14:12:54.923 INFO  ConnectionPool:72 | Created connection for pulsar://pulsar:6650

我真的很想弄清楚这一点。我提前感谢任何帮助!

4

1 回答 1

2

当客户端尝试使用命名空间时,它看起来public/default尚未创建。

我已经尝试使用这个简单的 compose 文件来设置更大的延迟,以确保在客户端启动时独立服务完全准备好:

version: '3.2'

services:
  pulsar:
    image: apachepulsar/pulsar:latest
    command: bin/pulsar standalone
    ports:
      - "6650"
      - "8080"

  client:
    depends_on:
      - pulsar
    image: apachepulsar/pulsar:latest
    command: python -c "import pulsar, time; time.sleep(30); c = pulsar.Client('pulsar://pulsar:6650'); p = c.create_producer('my-topic')"

于 2019-05-15T17:00:05.387 回答