OLD | NEW |
(Empty) | |
| 1 #gRPC Naming and Discovery Support |
| 2 |
| 3 ## Overview |
| 4 |
| 5 gRPC supports DNS as the default name-system. A number of alternative name-syste
ms are used in various deployments. We propose an API that is general enough to
support a range of name-systems and the corresponding syntax for names. The gRPC
client library in various languages will provide a plugin mechanism so resolver
s for different name-systems can be plugged in. |
| 6 |
| 7 ## Detailed Proposal |
| 8 |
| 9 A fully qualified, self contained name used for gRPC channel construction uses
the syntax: |
| 10 |
| 11 ``` |
| 12 scheme://authority/endpoint_name |
| 13 ``` |
| 14 |
| 15 Here, scheme indicates the name-system to be used. Example schemes to be support
ed include: |
| 16 |
| 17 * `dns` |
| 18 |
| 19 * `zookeeper` |
| 20 |
| 21 * `etcd` |
| 22 |
| 23 Authority indicates some scheme-specific bootstrap information, e.g., for DNS, t
he authority may include the IP[:port] of the DNS server to use. Often, a DNS na
me may used as the authority, since the ability to resolve DNS names is already
built into all gRPC client libraries. |
| 24 |
| 25 Finally, the endpoint_name indicates a concrete name to be looked up in a given
name-system identified by the scheme and the authority. The syntax of endpoint
name is dictated by the scheme in use. |
| 26 |
| 27 ### Plugins |
| 28 |
| 29 The gRPC client library will switch on the scheme to pick the right resolver plu
gin and pass it the fully qualified name string. |
| 30 |
| 31 Resolvers should be able to contact the authority and get a resolution that they
return back to the gRPC client library. The returned contents include a list of
IP:port, an optional config and optional auth config data to be used for channe
l authentication. The plugin API allows the resolvers to continuously watch an e
ndpoint_name and return updated resolutions as needed. |
| 32 |
| 33 ## Zookeeper |
| 34 |
| 35 Apache [ZooKeeper](https://zookeeper.apache.org/) is a popular solution for buil
ding name-systems. Curator is a service discovery system built on to of ZooKeepe
r. We propose to organize names hierarchically as `/path/service/instance` simil
ar to Apache Curator. |
| 36 |
| 37 A fully-qualified ZooKeeper name used to construct a gRPC channel will look as f
ollows: |
| 38 |
| 39 ``` |
| 40 zookeeper://host:port/path/service/instance |
| 41 ``` |
| 42 Here `zookeeper` is the scheme identifying the name-system. `host:port` identifi
es an authoritative name-server for this scheme (i.e., a Zookeeper server). The
host can be an IP address or a DNS name. |
| 43 Finally `/path/service/instance` is the Zookeeper name to be resolved. |
| 44 |
| 45 ## Service Registration |
| 46 |
| 47 |
| 48 Service providers can register their services in Zookeeper by using a Zookeeper
client. |
| 49 |
| 50 Each service is a zookeeper node, and each instance is a child node of the corre
sponding service. For example, a MySQL service may have multiple instances, `/my
sql/1`, `/mysql/2`, `/mysql/3`. The name of the service or instance, as well as
an optional path is specified by the service provider. |
| 51 |
| 52 The data in service nodes is empty. Each instance node stores its address in the
format of `host:port`, where host can be either hostname or IP address. |
OLD | NEW |