facebookarchive / bistro

Bistro is a flexible distributed scheduler, a high-performance framework supporting multiple paradigms while retaining ease of configuration, management, and monitoring.
https://bistro.io
MIT License
1.04k stars 158 forks source link

How to run the simple example with docker? #30

Closed Hoohaha closed 5 years ago

Hoohaha commented 5 years ago

I built successfully a docker image in my local. And i want to runthe simple example by docker-compose which is mentioned in the README.md. But the woker saide that BistroWorkerHandler.cpp:755] Unable to send heartbeat to scheduler: Channel is !good()

Bellow is my docker-compose.yml

version: "3.2"
services:
  scheduler:
    image: bistro
    working_dir: "/home/bistro/bistro"
    command: ["./cmake/Debug/server/bistro_scheduler", "--server_port=6789", "--http_server_port=6790", "--config_file=scripts/test_configs/simple", "--clean_statuses", "--CAUTION_startup_wait_for_workers=1", "--instance_node_name=scheduler"]
    ports:
      - "6789:6789"
      - "6790:6790"

  worker:
    image: bistro
    working_dir: "/home/bistro/bistro"
    command: ["./cmake/Debug/worker/bistro_worker", "--server_port=27182", "--scheduler_host=scheduler", "--scheduler_port=6789", "--worker_command=$HOME/demo_bistro_task.sh", "--data_dir=."]
    ports:
      - "27182:27182"
    links:
      - scheduler
    depends_on:
      - scheduler

I tried following setting for scheduler_host, that all are not working. --scheduler_host=scheduler, --scheduler_host=::, --scheduler_host=0.0.0.0

What's the problem? Does anybody used the docker-compose?

snarkmaster commented 5 years ago

I've personally never used docker-compose, so I'm not sure why your DNS entry scheduler is not working (you could look at /etc/hosts and /etc/resolv.conf and try to figure that out, and/or search the web for further help).

To the best of my knowledge, one does not connect to either :: or 0.0.0.0 — those have meaning as addresses for a server to listen on, but not for clients to connect to.

In the message you quoted, the error is coming from a client failing to connect to the server.

The easiest thing to do is probably to run ifconfig to figure out the interfaces that the scheduler might be listening on. You can also try ss -nlp | grep scheduler or netstat -nlp | grep scheduler to see what interface it's listening on.

I hope that these tips help you find the right address to connect to.

aillusions commented 5 years ago

Often you would want to define a network and use it for all services to avoid such problems https://docs.docker.com/compose/networking/

image