# Issue with Docker swarm

**URL:** <https://discuss.dgraph.io/t/issue-with-docker-swarm/2642>\
**Category:** Users\
**Created:** [May 25, 2018, 4:11pm UTC](https://discuss.dgraph.io/t/issue-with-docker-swarm/2642 "2018-05-25T16:11:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddibiase](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ddibiase/32/1157_2.png) [@ddibiase](https://discuss.dgraph.io/u/ddibiase)\
**Post date:** [May 25, 2018, 4:11pm UTC](https://discuss.dgraph.io/t/issue-with-docker-swarm/2642/1 "2018-05-25T16:11:03Z")

</div>

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.

```auto
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`

```auto
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

```

---

<div class="post-metadata">

**Author:** ![ddibiase](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ddibiase/32/1157_2.png) [@ddibiase](https://discuss.dgraph.io/u/ddibiase)\
**Post date:** [May 25, 2018, 9:43pm UTC](https://discuss.dgraph.io/t/issue-with-docker-swarm/2642/2 "2018-05-25T21:43:10Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [May 25, 2018, 10:48pm UTC](https://discuss.dgraph.io/t/issue-with-docker-swarm/2642/3 "2018-05-25T22:48:45Z")

</div>

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](https://docs.dgraph.io/deploy#more-about-dgraph-zero)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [June 24, 2018, 10:48pm UTC](https://discuss.dgraph.io/t/issue-with-docker-swarm/2642/4 "2018-06-24T22:48:58Z")

</div>

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