I can do something like this? (Two Dgraphs in the same host, different ports)

version: "3"
services:
  zeroapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zero:5080
  serverapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    ports:
      - 8081:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --my=server:7080 --memory_mb=2048 --zero=zero:5080
  zeroTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zero:5081
  serverTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    ports:
      - 8087:8080
      - 9087:9080
    restart: on-failure
    command: dgraph server --my=server:7081 --memory_mb=1048 --zero=zero:5081
volumes:
  localdata:
    driver: local
  localdata2:
    driver: local

Yes, you can definitely do that.

But i’m getting errors.

zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/11 22:57:16 raft.go:494: While applying proposal: Invalid address
serverapi_1  | 2017/12/11 22:57:16 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/11 22:57:16 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/11 22:57:16 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/11 22:57:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/11 22:57:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/11 22:57:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/11 22:57:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/11 22:57:18 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroTwo_1    | Running Dgraph zero...
zeroTwo_1    | 2017/12/11 22:57:20 raft.go:749: INFO: 1 is starting a new election at term 2
zeroTwo_1    | 2017/12/11 22:57:20 raft.go:580: INFO: 1 became candidate at term 3
zeroTwo_1    | 2017/12/11 22:57:20 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 3
zeroTwo_1    | 2017/12/11 22:57:20 raft.go:621: INFO: 1 became leader at term 3
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:118: == CONNECT ==> Setting server:7080
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/11 22:57:16 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/11 22:57:19 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/11 22:57:19 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
Gracefully stopping... (press Ctrl+C again to force)

I’m not fluent with Kubernetes (looks like Kubernetes config) however I can see a few things that might be wrong.

The port offset for zeroapi and zeroTwo are both -2000, so there will be a port conflict. Try setting these different.

Perhaps --my=server:7080 could be the problem as well, I don’t see server defined anywhere as a host. Again, not too familiar with Kubernetes so I might be totally off the mark here.

@pawan is the resident Kubernetes expert, so might be able to help when he comes online later today.

It’s a just normal Docker.

I tried using these configs below to try to “isolate”, but nothing.

    depends_on:
      - serverapi
    links:
      - serverapi

Updated:


command: dgraph server --my=server:7080 --memory_mb=2048 --zero=zero:5080
command: dgraph server --my=server:7081 --memory_mb=1048 --zero=zero:5081

command: dgraph zero --port_offset -2000 --my=zero:5080
command: dgraph zero --port_offset -2001 --my=zero:5081

UPDATE 2:

version: "3"
networks:
  dgraph:
  dgraphTwo:
services:
  zeroapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zeroapi:5080
  serverapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    networks:
      - dgraph
    ports:
      - 8081:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --my=serverapi:7080 --memory_mb=2048 --zero=zeroapi:5080

  zeroTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    networks:
      - dgraphTwo
    restart: on-failure
    command: dgraph zero --port_offset -1999 --my=zeroTwo:5081
  serverTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    ports:
      - 8087:8080
      - 9087:9080
    restart: on-failure
    command: dgraph server --my=serverTwo:7081 --memory_mb=2048 --zero=dgraphTwo.zeroTwo:5081
volumes:
  localdata:
    driver: local
  localdata2:
    driver: local

Can you show the logs that you get? Do you get the same problem when you run the commands outside of Docker?

Hey @MichelDiz

Are you using Docker Compose or Docker Swarm for this?

We have some sample docker_compose files for both here https://docs.dgraph.io/deploy/#cluster-setup-using-docker-swarm. The HA setup starts 6 Dgraph Server and 3 Zero nodes. You could modify it to your use case.

To help you with your config I need some information.

  1. Are you trying to setup a cluster with 2 Dgraph Zero and Server nodes?
    If this is the case then Zero should have different idx. Pass --idx 1 to first Zero and --idx 2 to second Zero. No need no pass idx to Server as it automatically gets it.

  2. Do you want to run all on same machine or on multiple machines?

  3. What command are you using to bootup this setup?

Docker Compose

PS. Not a cluster

I saw this, but I really wanted to have two different Dgraph instances on the same Host.

the terminal recorded https://youtu.be/N6PHG-QqzjM

obs: Isn’t a cluster.

The below yml I edited, was missing “network” in the services. But it still keeps making errors.

zeroapi_1    | 2017/12/12 02:07:14 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/12 02:07:14 raft.go:494: While applying proposal: Invalid address
zeroapi_1    | 2017/12/12 02:07:14 raft.go:494: While applying proposal: Invalid address
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:14 pool.go:118: == CONNECT ==> Setting serverapi:7080
serverapi_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/12 02:07:15 groups.go:117: Connected to group zero. Connection state: member:<id:1 addr:"serverapi:7080" > state:<counter:1315 groups:<key:1 value:<members:<key:1 value:<id:1 group_id:1 addr:"serverapi:7080" leader:true last_update:1513037570 > > tablets:<key:"_dummy_" value:<group_id:1 predicate:"_dummy_" space:19 > > tablets:<key:"_predicate_" value:<group_id:1 predicate:"_predicate_" > > > > zeros:<key:1 value:<id:1 addr:"zeroapi:5080" leader:true > > maxTxnTs:20000 maxRaftId:1197 >
serverapi_1  | 2017/12/12 02:07:15 draft.go:140: Node ID: 1 with GroupID: 1
serverapi_1  | 2017/12/12 02:07:15 node.go:233: Found Snapshot: {Data:[9 1 0 0 0 0 0 0 0 16 1 26 11 115 101 114 118 101 114 58 55 48 56 48] Metadata:{ConfState:{Nodes:[1] XXX_unrecognized:[]} Index:3 Term:2 XXX_unrecognized:[]} XXX_unrecognized:[]}
serverapi_1  | 2017/12/12 02:07:15 node.go:248: Found hardstate: {Term:12 Vote:1 Commit:13 XXX_unrecognized:[]}
serverapi_1  | 2017/12/12 02:07:15 node.go:260: Group 1 found 10 entries
serverapi_1  | 2017/12/12 02:07:15 draft.go:654: Restarting node for group: 1
serverapi_1  | 2017/12/12 02:07:15 raft.go:567: INFO: 1 became follower at term 12
serverapi_1  | 2017/12/12 02:07:15 raft.go:315: INFO: newRaft 1 [peers: [1], term: 12, commit: 13, applied: 3, lastindex: 13, lastterm: 12]
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroTwo_1    | 2017/12/12 02:07:13 node.go:127: Setting conf state to nodes:2
serverapi_1  | 2017/12/12 02:07:15 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:15 groups.go:617: WARNING: We don't have address of any dgraphzero server.
zeroapi_1    | 2017/12/12 02:07:15 zero.go:310: Got connection request: id:1 addr:"serverapi:7080"
zeroapi_1    | 2017/12/12 02:07:15 zero.go:406: Connected
serverapi_1  | 2017/12/12 02:07:16 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:16 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverTwo_1  | 2017/12/12 02:07:15 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/12 02:07:17 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:17 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:17 raft.go:749: INFO: 1 is starting a new election at term 12
serverapi_1  | 2017/12/12 02:07:17 raft.go:580: INFO: 1 became candidate at term 13
serverapi_1  | 2017/12/12 02:07:17 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 13
serverapi_1  | 2017/12/12 02:07:17 raft.go:621: INFO: 1 became leader at term 13
serverapi_1  | 2017/12/12 02:07:17 node.go:301: INFO: raft.node: 1 elected leader 1 at term 13
serverapi_1  | 2017/12/12 02:07:18 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:18 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:19 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:19 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverTwo_1  | 2017/12/12 02:07:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverapi_1  | 2017/12/12 02:07:20 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:20 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:21 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:21 groups.go:617: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:22 groups.go:438: WARNING: We don't have address of any dgraphzero server.
serverapi_1  | 2017/12/12 02:07:22 groups.go:617: WARNING: We don't have address of any dgraphzero server.
zeroapi_1    | 2017/12/12 02:07:16 raft.go:749: INFO: 1 is starting a new election at term 33
zeroapi_1    | 2017/12/12 02:07:16 raft.go:580: INFO: 1 became candidate at term 34
zeroapi_1    | 2017/12/12 02:07:16 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 34
zeroapi_1    | 2017/12/12 02:07:16 raft.go:621: INFO: 1 became leader at term 34
zeroapi_1    | 2017/12/12 02:07:16 node.go:301: INFO: raft.node: 1 elected leader 1 at term 34
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:20 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:24 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:23 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:26 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:34 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:39 Unable to join cluster via dgraphzero
docker_serverTwo_1 exited with code 1
serverTwo_1  | 2017/12/12 02:07:14 gRPC server started.  Listening on port 9080
serverTwo_1  | 2017/12/12 02:07:14 HTTP server started.  Listening on port 8080
serverTwo_1  | 2017/12/12 02:07:14 groups.go:94: Current Raft Id: 1
serverTwo_1  | 2017/12/12 02:07:14 worker.go:99: Worker listening at address: [::]:7080
serverTwo_1  | 2017/12/12 02:07:14 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 pool.go:118: == CONNECT ==> Setting dgraphTwo.zeroTwo:5081
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:14 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:15 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:17 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:20 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:24 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:26 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:34 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:39 Unable to join cluster via dgraphzero
serverTwo_1  | 2017/12/12 02:07:41 gRPC server started.  Listening on port 9080
serverTwo_1  | 2017/12/12 02:07:41 HTTP server started.  Listening on port 8080
serverTwo_1  | 2017/12/12 02:07:41 groups.go:94: Current Raft Id: 1
serverTwo_1  | 2017/12/12 02:07:41 worker.go:99: Worker listening at address: [::]:7080
serverTwo_1  | 2017/12/12 02:07:41 pool.go:167: Echo error from dgraphTwo.zeroTwo:5081. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:41 pool.go:118: == CONNECT ==> Setting dgraphTwo.zeroTwo:5081
serverTwo_1  | 2017/12/12 02:07:41 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:41 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:41 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:41 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:41 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
serverTwo_1  | 2017/12/12 02:07:42 groups.go:110: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:33 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:43 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:43 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure
zeroapi_1    | 2017/12/12 02:07:43 pool.go:167: Echo error from server:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure

Last tested:


version: "3"
networks:
  dgraph:
  dgraphTwo:
services:
  zeroapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    networks:
      - dgraph
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zeroapi:5080 --idx 1
  serverapi:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata:/dgraph
    networks:
      - dgraph
    ports:
      - 8081:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --my=serverapi:7080 --memory_mb=2048 --zero=zeroapi:5080

  zeroTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    networks:
      - dgraphTwo
    restart: on-failure
    command: dgraph zero --port_offset -1999 --my=zeroTwo:5081 --idx 2
  serverTwo:
    image: dgraph/dgraph:latest
    volumes:
      - /localdata2:/dgraph
    networks:
      - dgraphTwo
    ports:
      - 8087:8080
      - 9087:9080
    restart: on-failure
    command: dgraph server --my=serverTwo:7081 --memory_mb=2048 --zero=dgraphTwo.zeroTwo:5081
volumes:
  localdata:
    driver: local
  localdata2:
    driver: local

Ok, so from what I understand you want to run two completely unrelated instances of Dgraph (Server and Zero) on the same machine using Docker Compose.

You can do it using the following docker-compose.yml

version: "3"
services:
  zero1:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data1:/dgraph
    ports:
      - 6080:6080
    restart: on-failure
    command: dgraph zero --port_offset -2000 --my=zero1:5080
  server1:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data1:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --my=server1:7080 --memory_mb=2048 --zero=zero1:5080
  zero2:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data2:/dgraph
    ports:
      - 6081:6081
    restart: on-failure
    command: dgraph zero --port_offset -1999 --my=zero2:5081
  server2:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data2:/dgraph
    ports:
      - 8081:8081
      - 9081:9081
    restart: on-failure
    command: dgraph server --my=server2:7081 --memory_mb=2048 --zero=zero2:5081 -o 1

You can also verify that things are setup correctly and both of your single server clusters are working fine by checking

http://127.0.0.1:6080/state and http://127.0.0.1:6081/state

Perfect! exactly what I wanted. Thanks again Pawan. You all rock!

1 Like

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