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

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