I am trying to establish Dgraph connection using gRPC client, even though the Port is wrong its not throwing an error
How to check the connection whether the connection is established sucessfully and how to do health checks for the connection
Point me to the documentation if any
Thank you
func newClient() *dgo.Dgraph {
// Dial a gRPC connection. The address to dial to can be configured when
// setting up the dgraph cluster.
d, err := grpc.Dial("localhost:9080", grpc.WithInsecure())
if err != nil {
log.Fatal(err)
}
return dgo.NewDgraphClient(
api.NewDgraphClient(d),
)
}
It does not throw an error at the time of the creation of the client. It just initializes the structures. However, if you try to connect to the alpha for query, mutation etc., it throws an error. (try altering the schema https://dgraph.io/docs/clients/#alter-the-database)That’s when the client contacts the alpha.
If you want to do health check connection establishment via client then sending a low payload request could be one simple way. Logs at server might be another useful way. Maybe @dmai, @MichelDiz can point you with some other methods. You can look at https://godoc.org/github.com/dgraph-io/dgo for other available APIs of Dgraph go-client.