Commit 4f7830ec authored by zhangyaofu's avatar zhangyaofu

update doc for consul naming service

parent 50d26f74
...@@ -96,6 +96,14 @@ BNS是百度内常用的名字服务,比如bns://rdev.matrix.all,其中"bns" ...@@ -96,6 +96,14 @@ BNS是百度内常用的名字服务,比如bns://rdev.matrix.all,其中"bns"
连接一个域名下所有的机器, 例如http://www.baidu.com:80 ,注意连接单点的Init(两个参数)虽然也可传入域名,但只会连接域名下的一台机器。 连接一个域名下所有的机器, 例如http://www.baidu.com:80 ,注意连接单点的Init(两个参数)虽然也可传入域名,但只会连接域名下的一台机器。
### consul://\<service-name\>
通过consul获取服务名称为service-name的服务列表,默认只获取状态为passing的服务。
当brpc服务重启时如果consul不可访问,服务可自动降级到file naming service获取服务列表。服务列表文件可通过consul-template生成,里面会保存consul不可用之前最新的下游服务节点。当consul恢复时可自动恢复到consul naming service。
除了对consul的首次请求,后续对consul的请求都采用long polling的方式,即仅当服务列表更新或请求超时后consul才返回结果。
### 名字服务过滤器 ### 名字服务过滤器
当名字服务获得机器列表后,可以自定义一个过滤器进行筛选,最后把结果传递给负载均衡: 当名字服务获得机器列表后,可以自定义一个过滤器进行筛选,最后把结果传递给负载均衡:
......
...@@ -96,6 +96,15 @@ Servers are directly written after list://, separated by comma. For example: "li ...@@ -96,6 +96,15 @@ Servers are directly written after list://, separated by comma. For example: "li
Connect all servers under the domain, for example: http://www.baidu.com:80. Note: although Init() for connecting single server(2 parameters) accepts hostname as well, it only connects one server under the domain. Connect all servers under the domain, for example: http://www.baidu.com:80. Note: although Init() for connecting single server(2 parameters) accepts hostname as well, it only connects one server under the domain.
### consul://\<service-name\>
Get a list of services with the specified service name through consul. By default, only services with the status of passing are obtained.
If consul is not accessible when the brpc service is restarted, the naming service can be automatically downgraded to the file naming service to obtain the service list. The service list file can be generated through the consul-template, which will save the latest downstream service node before the consul is unavailable. When consul recovers, naming service can automatically switch back to consul naming service.
In addition to the first request to the consul, subsequent requests to the consul use long polling. Long polling means that consul returns results only when the service list updates or requests time out.
### Naming Service Filter ### Naming Service Filter
Users can filter servers got from the NamingService before pushing to LoadBalancer. Users can filter servers got from the NamingService before pushing to LoadBalancer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment