Issue with Docker swarm

Hi,

I’m deploying a new DGraph instance with Docker 18. I’ve setup a two instance swarm, both nodes are online and fully operational. When I deploy the following compose file, the services create but hang at 0/1 replicas. I’m struggling to find out what the issue is. Note that I’m using dgraph/dgraph:latest.

version: "3"
networks:
  dgraph:
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - data-volume:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == AP-GRAPH-1
    command: dgraph zero --my=zero:5080 --replicas 2
  server_1:
    image: dgraph/dgraph:latest
    hostname: "server_1"
    volumes:
      - data-volume:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == AP-GRAPH-1
    command: dgraph server --my=server_1:7080 --lru_mb=17192 --zero=zero:5080
  server_2:
    image: dgraph/dgraph:latest
    hostname: "server_2"
    volumes:
      - data-volume:/dgraph
    ports:
      - 8081:8081
      - 9081:9081
    networks:
      - dgraph
    deploy:
      placement:
        constraints:
          - node.hostname == AP-GRAPH-2
    command: dgraph server --my=server_2:7081 --lru_mb=17192 --zero=zero:5080 -o 1
  ratel:
    image: dgraph/dgraph:latest
    hostname: "ratel"
    ports:
      - 8000:8000
    networks:
      - dgraph
    command: dgraph-ratel
    deploy:
      placement:
        constraints:
          - node.hostname == AP-GRAPH-1
volumes:
  data-volume:

What I see when I docker service ls

ID                  NAME                MODE                REPLICAS            IMAGE                  PORTS
2va8p4ktaroj        dgraph_ratel        replicated          0/1                 dgraph/dgraph:latest   *:8000->8000/tcp
i34iuc96w94s        dgraph_server_1     replicated          0/1                 dgraph/dgraph:latest   *:8080->8080/tcp, *:9080->9080/tcp
y0kqqeptosev        dgraph_server_2     replicated          0/1                 dgraph/dgraph:latest   *:8081->8081/tcp, *:9081->9081/tcp
mw5mkat80cr2        dgraph_zero         replicated          0/1                 dgraph/dgraph:latest   *:5080->5080/tcp, *:6080->6080/tcp

Hmmm, I resolved the problem listed above. My hostnames weren’t setting properly – so non issue.

I did have a follow up question. Given my configuration I should have two servers deployed of which I should be able to make GRPC requests to:

AP-GRAPH-1 on 9080
AP-GRAPH-2 on 9081

If I send all my traffic through AP-GRAPH-1 do I still get the performance of the cluster or do I need to distribute my traffic to both servers (balance the load between both?). Wondering if DGraph handles it internally or if I need to send traffic accordingly.

Hi,

if all servers are “full replicas” (with the same data) it’s okay you do some “Balancing”, but Dgraph Zero has some level of balancing control. In special when you’re using a sharded Dgraph DB environment.

More about Zero https://docs.dgraph.io/deploy#more-about-dgraph-zero

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