Skip to content

Commit

Permalink
docs: update the nacos v2 version (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyt122 authored Sep 23, 2024
1 parent 8ec4d02 commit a0b100b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
23 changes: 10 additions & 13 deletions site/content/en/docs/reference/registries/nacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@ title: Nacos

## Description

The `nacos` registry interfaces with [Nacos](https://nacos.io/) service discovery, converting service information into `ServiceEntry`. This registry supports the V1 API, but according to the Nacos OpenAPI documentation, it can also be used to interface with Nacos 2.x.

> Nacos 2.X is compatible with Nacos 1.X OpenAPI, please refer to the document Nacos1.X OpenAPI.
>
> https://nacos.io/en/docs/v2/guide/user/open-api/
The `nacos` registry interfaces with [Nacos](https://nacos.io/) service discovery, converting service information into `ServiceEntry`. This registry supports the V1 API and the V2 API.

## Configuration

| Name | Type | Required | Validation | Description |
|--------------------------|---------------------------------|----------|-------------------|--------------------------------------------------------|
| version | string | True | v1 or v2 | Nacos version |
| serverUrl | string | True | must be valid URI | Nacos URL |
| namespace | string | False | | Nacos namespace. Default is "public". |
| groups | string[] | False | min_len = 1 | List of Nacos groups. Default is ["DEFAULT_GROUP"]. |
| serviceRefreshInterval | [Duration](../type.md#duration) | False | gte: 1s | Interval for polling the service list. Default is 30s. |
| Name | Type | Required | Validation | Description |
| ---------------------- | ------------------------------- | -------- | ----------------- | ------------------------------------------------------ |
| version | string | True | v1 or v2 | Nacos version |
| serverUrl | string | True | must be valid URI | Nacos URL |
| namespace | string | False | | Nacos namespace. Default is "public". |
| groups | string[] | False | min_len = 1 | List of Nacos groups. Default is ["DEFAULT_GROUP"]. |
| serviceRefreshInterval | [Duration](../type.md#duration) | False | gte: 1s | Interval for polling the service list. Default is 30s. |

Nacos 1.x does not provide an API to subscribe to the current service list, so polling is the only way to retrieve the service list. Configuring a smaller value can allow for quicker detection of service deletions, but will place more pressure on Nacos.
Nacos does not provide an API to subscribe to the current service list, so polling is the only way to retrieve the service list. Configuring a smaller value can allow for quicker detection of service deletions, but will place more pressure on Nacos.

If a domain name is used inside `serverUrl`, it must be an FQDN, such as `svc.cluster.local`, rather than `svc`.

Expand Down Expand Up @@ -69,6 +65,7 @@ spec:
type: nacos
config:
serverUrl: http://172.0.0.1:8848
version: v1
```

For a registered service with a namespace of `public`, group of `prod`, name of `svr`, metadata of `{"type":"server"}`, IP of `192.168.0.1`, and port of 8080, the following configuration will be generated:
Expand Down
22 changes: 10 additions & 12 deletions site/content/zh-hans/docs/reference/registries/nacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ title: Nacos

## 说明

`nacos` registry 对接 [Nacos](https://nacos.io/) 服务发现,将服务信息转换成 `ServiceEntry`。该 registry 支持的是 V1 API,但根据 Nacos OpenAPI 文档,亦可用于对接 Nacos 2.x
`nacos` registry 对接 [Nacos](https://nacos.io/) 服务发现,将服务信息转换成 `ServiceEntry`。该 registry 既支持 V1 API,也支持 V2 API

> Nacos 2.X 版本兼容 Nacos1.X 版本的 OpenAPI, 请参考文档 Nacos1.X OpenAPI 使用。
>
> https://nacos.io/zh-cn/docs/v2/guide/user/open-api.html

## 配置

| 名称 | 类型 | 必选 | 校验规则 | 说明 |
|-------------------------|---------------------------------|----|-------------------|---------------------------------------|
| version | string || v1 or v2 | Nacos version |
| serverUrl | string || must be valid URI | Nacos URL |
| namespace | string || | Nacos namespace。默认为 "public"。 |
| groups | string[] || min_len = 1 | Nacos group 列表。默认为 ["DEFAULT_GROUP"]|
| serviceRefreshInterval | [Duration](../type.md#duration) || gte: 1s | 轮询服务列表的间隔。默认为 30s。 |
| 名称 | 类型 | 必选 | 校验规则 | 说明 |
| ---------------------- | ------------------------------- | ---- | ----------------- | -------------------------------------------- |
| version | string | | v1 or v2 | Nacos version |
| serverUrl | string | | must be valid URI | Nacos URL |
| namespace | string | | | Nacos namespace。默认为 "public"。 |
| groups | string[] | | min_len = 1 | Nacos group 列表。默认为 ["DEFAULT_GROUP"]|
| serviceRefreshInterval | [Duration](../type.md#duration) | | gte: 1s | 轮询服务列表的间隔。默认为 30s。 |

Nacos 1.x 没有提供订阅当前服务列表的接口,所以只能通过轮询来获取服务列表。配置一个较小的值可以更快得知服务被删除,但是会给 Nacos 带来更大的压力。
Nacos 没有提供订阅当前服务列表的接口,所以只能通过轮询来获取服务列表。配置一个较小的值可以更快得知服务被删除,但是会给 Nacos 带来更大的压力。

如果在 `serverUrl` 里面使用域名,它必须是 FQDN,如 `svc.cluster.local`,而不是 `svc`

Expand Down Expand Up @@ -69,6 +66,7 @@ spec:
type: nacos
config:
serverUrl: http://172.0.0.1:8848
version: v1
```

对于一个 namespace 为 `public`,group 为 `prod`,名称为 `svr`,metadata 为 `{"type":"server"}`,IP 为 `192.168.0.1`,port 为 8080 的注册服务,将生成如下配置:
Expand Down

0 comments on commit a0b100b

Please sign in to comment.