Using the gRPC API of etcd 3

1,804 views
Skip to first unread message

Vladimir Matveev

unread,
Jul 23, 2016, 6:50:03 PM7/23/16
to etcd-dev
Hi,

etcd v3 apparently provides a gRPC API instead of an HTTP API. I know about the gateway, but I'm interested in using the gRPC API directly.

So suppose I want to use etcd from my program written e.g. in Scala. How do I do it? First of all, I need protobuf definitions for the RPC services and the messages. I found several proto definitions in the etcd sources, in particular, rpc.proto, but I'm fairly sure I won't be able just to copy it to my project and allow the build system to generate stubs for services in Scala, at least because rpc.proto imports other proto files which I don't know where to search for.

Are there any step-by-step instructions on how to use the gRPC API?

Thanks.

Best regards,
Vladimir

Xiang Li

unread,
Jul 23, 2016, 7:01:40 PM7/23/16
to Vladimir Matveev, etcd-dev
The best way to do it is to get a client library working to hide all gRPC details. We are working on a java API here: https://github.com/coreos/jetcd.

--
You received this message because you are subscribed to the Google Groups "etcd-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etcd-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vladimir Matveev

unread,
Jul 24, 2016, 5:53:47 AM7/24/16
to etcd-dev, dpx.in...@gmail.com
Ok, I see. I'll be waiting then for its release, thanks!

Joe

unread,
Jul 25, 2016, 5:29:07 AM7/25/16
to etcd...@googlegroups.com
For what it's worth, I am writing a python client for etcd3 (soon to be
released in pre-alpha shape) and I used the following proto files to
autogenerate the grpc wire protocol python classes:

etcdserver/etcdserverpb/rpc.proto
auth/authpb/auth.proto
mvcc/mvccpb/kv.proto

starting from those and the dependencies therein you can have grpc
autogenerate the basic classes for you.

I am still having some issues with getting auth working in python (I can
authenticate and get a token, but I can't seem to authenticate
subsequent requests) but more on that in a later email.

What we should stress more is that there is a lot of behaviour of the
etcd version 3 api that I have either to figure out by trial and error
or by reading the client/server go code; I don't think production
software can be so sparse in information about the details of its API.
(Take as an example leases or transaction: read the existing docs and
tell me if you would have an idea of how to use either correctly without
further investigation).

Also, error returns are completely undocumented, and that is a nightmare
as one has to reverse-engineer the failure states for each kind of
event. Using gRPC in the middle just fuzzies things up more as it's a
huge black box you're relying onto.

I think there is a *lot* of work to do in order to have casual
third-party developers feel at ease with this API, and I am trying to
abstract a little on top of it in the Python library to make user's
lifes easier.

I am planning to write an email with a few questions to etcd devs
whenever I have time (I am doing this on my free time) asking for more
details.

Thanks,

joe

asko....@zalando.fi

unread,
May 31, 2017, 5:05:34 AM5/31/17
to etcd-dev, j...@autistici.org
Thanks, Joe

I'm looking at using etcd via gRPC from Scala, and your email gives confidence the path is right.  I'm glad you wrote it! 

- asko
Reply all
Reply to author
Forward
0 new messages