What is wrong with my docker-compose config (several groups)

Hi!
I am having troubles starting multiple alphas what should be moved into two groups. I try to run on the single host to test how things are doing with dgraph.

My docker-compose config is

version: "3.2"
networks:
  dgraph:
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - zero:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == aws01
    command: dgraph zero --my=zero:5080 --replicas 3
  alpha_1:
    image: dgraph/dgraph:latest
    hostname: "alpha_1"
    volumes:
      - alpha_1:/dgraph
    ports:
      - 8081:8080
      - 9081:9080
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == aws01
    command: dgraph alpha --my=alpha_1:7080 --lru_mb=2048 --zero=zero:5080
  alpha_2:
    image: dgraph/dgraph:latest
    hostname: "alpha_2"
    volumes:
      - alpha_2:/dgraph
    ports:
      - 8082:8080
      - 9082:9080
    networks:
      - dgraph
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.hostname == aws02
    command: dgraph alpha --my=alpha_2:7081 --lru_mb=2048 --zero=zero:5080 -o 1
  alpha_3:
    image: dgraph/dgraph:latest
    hostname: "alpha_3"
    volumes:
      - alpha_3:/dgraph
    ports:
      - 8083:8080
      - 9083:9080
    networks:
      - dgraph
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.hostname == aws03
    command: dgraph alpha --my=alpha_3:7082 --lru_mb=2048 --zero=zero:5080 -o 2
  alpha_4:
    image: dgraph/dgraph:latest
    hostname: "alpha_4"
    volumes:
      - alpha_4:/dgraph
    ports:
      - 8084:8080
      - 9084:9080
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == aws04
    command: dgraph alpha --my=alpha_4:7083 --lru_mb=2048 --zero=zero:5080
  alpha_5:
    image: dgraph/dgraph:latest
    hostname: "alpha_5"
    volumes:
      - alpha_2:/dgraph
    ports:
      - 8085:8080
      - 9085:9080
    networks:
      - dgraph
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.hostname == aws05
    command: dgraph alpha --my=alpha_2:7084 --lru_mb=2048 --zero=zero:5080 -o 1
  alpha_6:
    image: dgraph/dgraph:latest
    hostname: "alpha_6"
    volumes:
      - alpha_6:/dgraph
    ports:
      - 8086:8080
      - 9086:9080
    networks:
      - dgraph
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.hostname == aws06
    command: dgraph alpha --my=alpha_3:7085 --lru_mb=2048 --zero=zero:5080 -o 2
  ratel:
    image: dgraph/dgraph:latest
    hostname: "ratel"
    ports:
      - 8000:8000
    networks:
      - dgraph
    command: dgraph-ratel
volumes:
  zero:
  alpha_1:
  alpha_2:
  alpha_3:
  alpha_4:
  alpha_5:
  alpha_6:

In the end, only one group works at best (sometimes no group is working). What is wrong with my compose setup?

The right one should be like:

ports:
  - 8081:8081
  - 9081:9081

The ports are wrong. And you don’t need a volume for each Alphas and Zero.

This port in “alpha_6” is totally wrong for this you need set the flag as -o 6

It works, thank you!

PS Dedicated volumes for alphas and zero(s) are actually needed. They (alphas and zeroes) are fighting for file/directory locks otherwise

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.