Dgraph cluster setup

Hello,

I would like to deploy a simple dGraph cluster consisted of two docker containers, one would contain zero instance, and the other one the alpha instance. To do this, I’ve referred to the documentation (Learning Environment - Installation (dgraph.io)).

I would like to run the zero instance on localhost:5080, and configure the host to forward requests to that container port 5800. The alpha instance should connect to the zero instance using host IP 192.168.0.100:5800, also the alpha instance should use localhost:7080.

Zero command:

docker run -d -p 5080:5080 -p 6080:6080 dgraph/dgraph:latest dgraph zero --my=localhost:5080

Alpha command:

docker run -d -p 7080:7080 -p 8080:8080 -p 9080:9080 dgraph/dgraph:latest dgraph alpha --zero=192.168.0.100:5080 --my=localhost:7080

Unfortunately, this doesn’t work. The logs from the Zero instance:

I0309 08:48:27.707941      17 zero.go:506] Got connection request: cluster_info_only:true
I0309 08:48:27.708245      17 zero.go:531] Connected: cluster_info_only:true
I0309 08:48:27.811386      17 zero.go:506] Got connection request: cluster_info_only:true
I0309 08:48:27.811689      17 zero.go:531] Connected: cluster_info_only:true
...

Logs from the Alpha instance:

CONN: Connecting to 192.168.0.100:5080
I0309 09:23:49.053935      19 pool.go:164] CONN: Connecting to localhost:5080
E0309 09:23:49.949164      19 groups.go:1224] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
E0309 09:23:50.056933      19 pool.go:311] CONN: Unable to connect with localhost:5080 : rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:5080: connect: connection refused"
E0309 09:23:50.949638      19 groups.go:1224] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
...

What am I doing wrong here? You can ping one container from the other one, based on the logs in Zero, I assume that those are connection attempts.

Also, I would like to know, should the alpha & zero instances should use the same volume mount? I saw some examples in the documentation where they use the same mounts, and the other ones where they do not use it.

Thanks in advance!

I think the issue is the use of localhost in the --my parameters. Replace that in all cases with the name of the respective containers and it should be fine, in my case that is zero1 and alpha1 etc but it depends on your deploment script. That is also easier/more stable than raw ip addresses.

Using the same or different volume mount is really your preference. I tend to separate them as when you have multiple alphas in future they might accidentally mount the same alpha folders if you’re not careful.

Is it possible to set parameters as -my=0.0.0.0:5800 ? Therefore container will listen on all interfaces.