update nacos-discovery.adoc

pull/2152/head
XuDaojie 4 years ago
parent cf13c1cfe8
commit 2f53fcbfce

3
.gitignore vendored

@ -40,3 +40,6 @@ target
# Maven ignore
.flattened-pom.xml
# AsciiDoc
spring-cloud-alibaba-docs/**/*.html

@ -291,6 +291,39 @@ Endpoint 暴露的 json 中包含了两种属性:
}
----
=== 如何开启权重路由
==== Spring Cloud Loadbalancer
.pom.xml
[source,xml]
----
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
</dependency>
</dependencies>
----
.application.properties
[source,properties]
----
spring.cloud.loadbalancer.ribbon.enabled=false
----
.Application.java
[source,java]
----
@LoadBalancerClients(defaultConfiguration = NacosLoadBalancerClientConfiguration.class)
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
----
=== 关于 Nacos Discovery Starter 更多的配置项信息
更多关于 Nacos Discovery Starter 的配置项如下所示:
@ -310,7 +343,7 @@ Endpoint 暴露的 json 中包含了两种属性:
|日志文件名|`spring.cloud.nacos.discovery.log-name`||
|集群|`spring.cloud.nacos.discovery.cluster-name`|`DEFAULT`|Nacos集群名称
|接入点|`spring.cloud.nacos.discovery.endpoint`||地域的某个服务的入口域名,通过此域名可以动态地拿到服务端地址
|是否集成Ribbon|`ribbon.nacos.enabled`|`true`|一般都设置成true即可
|是否启用NacosLoadBalancer为默认路由|`loadbalancer.nacos.default.enabled`|`false`|true: 默认路由为NacosLoadBalancer
|是否开启Nacos Watch|`spring.cloud.nacos.discovery.watch.enabled`|`true`|可以设置成false来关闭 watch
|===

@ -294,6 +294,38 @@ The followings shows how a service instance accesses the Endpoint:
}
----
=== Weight Route
==== Spring Cloud Loadbalancer
.pom.xml
[source,xml]
----
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
</dependency>
</dependencies>
----
.application.properties
[source,properties]
----
spring.cloud.loadbalancer.ribbon.enabled=false
----
.Application.java
[source,java]
----
@LoadBalancerClients(defaultConfiguration = NacosLoadBalancerClientConfiguration.class)
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
----
=== More Information about Nacos Discovery Starter Configurations
The following shows the other configurations of the starter of Nacos Discovery:
@ -313,7 +345,7 @@ The following shows the other configurations of the starter of Nacos Discovery:
|Log file name|`spring.cloud.nacos.discovery.log-name`||
|Cluster Name|`spring.cloud.nacos.discovery.cluster-name`|`DEFAULT`|Cluster name of Nacos
|Endpoint|`spring.cloud.nacos.discovery.endpoint`||The domain name of a certain service in a specific region. You can retrieve the server address dynamically with this domain name
|Integrate Ribbon or not|`ribbon.nacos.enabled`|`true`|Set to true in most cases
|Enable NacosLoadBanancer is default route|`loadbalancer.nacos.default.enabled`|`false`|
|Enable Nacos Watch|`spring.cloud.nacos.discovery.watch.enabled`|`true`|set to false to close watch
|===

Loading…
Cancel
Save