This is an automated email from the ASF dual-hosted git repository.
wangchengming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-website.git
The following commit(s) were added to refs/heads/master by this push:
new 84e204243f [fix] 优化 nacos (#1213)
84e204243f is described below
commit 84e204243f3ebf850d90eda92bb0fd22ec6eabe6
Author: JIAN ZHONG <[email protected]>
AuthorDate: Sun Jul 10 20:59:20 2022 +0800
[fix] 优化 nacos (#1213)
---
.../reference-manual/registry/nacos/guide.md | 44 +++++++++++-----------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git
a/content/zh/docs3-building/java-sdk/reference-manual/registry/nacos/guide.md
b/content/zh/docs3-building/java-sdk/reference-manual/registry/nacos/guide.md
index a27ab64cac..7ff857e926 100644
---
a/content/zh/docs3-building/java-sdk/reference-manual/registry/nacos/guide.md
+++
b/content/zh/docs3-building/java-sdk/reference-manual/registry/nacos/guide.md
@@ -4,19 +4,21 @@ title: "使用说明"
linkTitle: "使用说明"
weight: 2
---
-
+## 特性说明
Nacos 是 Dubbo 生态系统中重要的注册中心实现,其中
[`dubbo-registry-nacos`](https://github.com/apache/incubator-dubbo/tree/master/dubbo-registry/dubbo-registry-nacos)
则是 Dubbo 融合 Nacos 注册中心的实现。
-## 预备工作
+#### 预备工作
当您将
[dubbo-registry-nacos](https://github.com/apache/incubator-dubbo/tree/master/dubbo-registry/dubbo-registry-nacos)
整合到您的 Dubbo 工程之前,请确保后台已经启动 Nacos 服务。如果您尚且不熟悉 Nacos 的基本使用的话,可先行参考 [Nacos
快速入门](https://nacos.io/en-us/docs/quick-start.html)。建议使用 Nacos `1.0.0` 及以上的版本。
-## 快速上手
-Dubbo 融合 Nacos 成为注册中心的操作步骤非常简单,大致步骤可分为“增加 Maven 依赖”以及“配置注册中心“。
+## 使用场景
+## 使用方式
+#### 快速上手
+Dubbo 融合 Nacos 成为注册中心的操作步骤非常简单,大致步骤可分为“增加 Maven 依赖”以及“配置注册中心“。
-### 增加 Maven 依赖
+#### 增加 Maven 依赖
首先,您需要将 `dubbo-registry-nacos` 的 Maven 依赖添加到您的项目 `pom.xml` 文件中,并且强烈地推荐您使用
Dubbo `2.6.5`:
@@ -24,28 +26,28 @@ Dubbo 融合 Nacos 成为注册中心的操作步骤非常简单,大致步骤
<dependencies>
...
-
+
<!-- Dubbo Nacos registry dependency -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>0.0.2</version>
- </dependency>
-
+ </dependency>
+
<!-- Keep latest Nacos client version -->
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>[0.6.1,)</version>
</dependency>
-
+
<!-- Dubbo dependency -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
-
+
<!-- Alibaba Spring Context extension -->
<dependency>
<groupId>com.alibaba.spring</groupId>
@@ -54,22 +56,20 @@ Dubbo 融合 Nacos 成为注册中心的操作步骤非常简单,大致步骤
</dependency>
...
-
+
</dependencies>
```
当项目中添加 `dubbo-registry-nacos` 后,您无需显式地编程实现服务发现和注册逻辑,实际实现由该三方包提供,接下来配置 Naocs
注册中心。
-### 配置注册中心
+#### 配置注册中心
-假设您 Dubbo 应用使用 Spring Framework 装配,将有两种配置方法可选,分别为:[Dubbo Spring
外部化配置](https://mercyblitz.github.io/2018/01/18/Dubbo-%E5%A4%96%E9%83%A8%E5%8C%96%E9%85%8D%E7%BD%AE/)以及
Spring XML 配置文件,推荐前者。
+假设您 Dubbo 应用使用 Spring Framework 装配,将有两种配置方法可选,分别为:[Dubbo Spring
外部化配置](https://mercyblitz.github.io/2018/01/18/Dubbo-%E5%A4%96%E9%83%A8%E5%8C%96%E9%85%8D%E7%BD%AE/)
以及 Spring XML 配置文件,推荐前者。
-### Dubbo Spring 外部化配置
+#### Dubbo Spring 外部化配置
->
[参考](https://mercyblitz.github.io/2018/01/18/Dubbo-%E5%A4%96%E9%83%A8%E5%8C%96%E9%85%8D%E7%BD%AE/)
-
-Dubbo Spring 外部化配置是由 Dubbo `2.5.8` 引入的新特性,可通过 Spring `Environment` 属性自动地生成并绑定
Dubbo 配置 Bean,实现配置简化,并且降低微服务开发门槛。
+Dubbo Spring
[外部化配置](https://mercyblitz.github.io/2018/01/18/Dubbo-%E5%A4%96%E9%83%A8%E5%8C%96%E9%85%8D%E7%BD%AE/)是由
Dubbo `2.5.8` 引入的新特性,可通过 Spring `Environment` 属性自动地生成并绑定 Dubbo 配置
Bean,实现配置简化,并且降低微服务开发门槛。
假设您的 Nacos Server 同样运行在服务器 `10.20.153.10` 上,并使用默认 Nacos 服务端口 `8848`,您只需将
`dubbo.registry.address` 属性调整如下:
@@ -93,7 +93,7 @@ dubbo.registry.address = nacos://10.20.153.10:8848
如果您正在使用 Spring XML 配置文件装配 Dubbo 注册中心的话,请参考下一节。
-### Spring XML 配置文件
+#### Spring XML 配置文件
与 [Dubbo Spring
外部化配置](https://mercyblitz.github.io/2018/01/18/Dubbo-%E5%A4%96%E9%83%A8%E5%8C%96%E9%85%8D%E7%BD%AE/)
配置类似,只需要调整 `address` 属性配置即可:
@@ -120,16 +120,14 @@ dubbo.registry.address = nacos://10.20.153.10:8848

-**附加信息**: 在nacos-server@`1.0.0`版本后,支持客户端通过上报一些包含特定的元数据的实例到服务端来控制实例的一些行为。
+**附加信息**: 在 nacos-server@`1.0.0` 版本后,支持客户端通过上报一些包含特定的元数据的实例到服务端来控制实例的一些行为。
-例如:
+**例如**:
`preserved.heart.beat.timeout` : 该实例在不发送心跳后,从健康到不健康的时间。(单位:毫秒)
`preserved.ip.delete.timeout` : 该实例在不发送心跳后,被服务端下掉该实例的时间。(单位:毫秒)
`preserved.heart.beat.interval` : 该实例在客户端上报心跳的间隔时间。(单位:毫秒)
`preserved.instance.id.generator`: 该实例的id生成策略,值为`snowflake`时,从0开始增加。
`preserved.register.source` : 保留键,目前未使用。
-该功能将在Dubbo@`2.7.10`开始支持,通过在address中增加参数来进行配置.
+该功能将在 Dubbo@`2.7.10`开始支持,通过在 address 中增加参数来进行配置.
例如:
`nacos://10.20.153.10:8848?preserved.heart.beat.timeout=15000&preserved.ip.delete.timeout=30000&preserved.heart.beat.interval=10000`
-
-