Understanding `--my` flag


#1

I have a few questions regarding the --my flag.

  1. What does “my” stand for?
  2. How does zero's behavior change depending on whether the flag was supplied?
  3. Why is it necessary to supply the IP address or host name of machine/container where zero is running? eg. --my=IPADDR:5080?
  4. Ditto 2 and 3, but for server

(Michel Conrado (Support Engineer)) #2

“my address” (I’m not sure if I understood the question)

Providing “–my” address is mandatory. I’m not sure about behavior. It’s just a connection approach.

“The --my flag is the connection that Dgraph servers would dial to talk to zero.” From docs

“addr:port of this server, so other Dgraph servers can talk to this.” from code.

Cheers.


#3

Thanks Michel for the quick response!

I did go through the docs before posting this, however, I was confused because in the Run Dgraph section of the tour, zero is initialized without specifying --my, and so is the server.

Also, I don’t quite understand why --my needs to be specified on both zero and server. Isn’t the --zero flag on the server sufficient to tell the server how to connect to zero? Why are both flags necessary?

Finally, can’t both zero and server figure out their own IP and port? I mention this because, although I’m not very familiar with Go, it’s trivial to do so in other languages/frameworks, such as JavaScript with express, so I’d be surprised if this was hard to code in Go.

As always, thanks for your patience and useful answers @MichelDiz :slight_smile:


(Michel Conrado (Support Engineer)) #4

When you do not put it it will keep the default addr. However, if you use settings like HA and etc. It is better to have an explicit configuration.

Well, many times the Dgraph might be being hosted in an environment like AWS or GKE. And these have specific rules that Dgraph does not control. Like DNS “dgraph-zero-0.dgraph-zero.default.svc.cluster.local:5080”.

It depends on the context, but technically Dgraph is not able to locate your iptables table for example or do a range search. If it’s all default it will work okay, now for Dgraph do analyze contexts it’s a bit complicated. It’s out of Dgraph’s scope.

Another problem is that the “Dgraph Server” does not know which “Dgraph Zero” you want it to be in. If you have a HA configuration for example. You must specify. For there may be “N” instances of Dgraph Zero running. Server instances would have no way of knowing which ones to follow.

Also if you change the offsets, would be a problem.

Dgraph is able to know its own configuration and not of third Dgraph instances wherever they are (e.g other network, other container). BTW You can even use “–bindall=true” when necessary.

A solution to this would be welcome with a PR. The go devs are focused on very specific things lately. I don’t know if this would be urgent. But as is, there is not much need for add some work on this feature.