You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/09 18:27:10 UTC

[GitHub] [apisix] Singularity0909 commented on a change in pull request #5023: docs: add Chinese doc for discovery DNS method

Singularity0909 commented on a change in pull request #5023:
URL: https://github.com/apache/apisix/pull/5023#discussion_r705594923



##########
File path: docs/zh/latest/discovery/dns.md
##########
@@ -0,0 +1,131 @@
+---
+title: DNS
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+* [通过 DNS 服务发现](#通过 DNS 服务发现)
+    * [SRV 记录](#SRV 记录)
+
+## 通过 DNS 服务发现
+
+某些服务发现系统如 Consul,支持通过 DNS 提供系统信息。我们可以使用这种方法直接实现服务发现。
+
+首先我们需要配置 DNS 服务器的地址:
+
+```yaml
+# 添加到 config.yaml
+discovery:
+   dns:
+     servers:
+       - "127.0.0.1:8600"          # 使用 DNS 服务器的真实地址
+```
+
+与配置 Upstream `nodes` 项不同的是,DNS 服务发现将返回所有的记录。例如按照以下的 upstream 配置:
+
+```json
+{
+    "id": 1,
+    "discovery_type": "dns",
+    "service_name": "test.consul.service",
+    "type": "roundrobin"
+}
+```
+
+之后 `test.consul.service` 将被解析为 `1.1.1.1` 和 `1.1.1.2`,这个结果等同于:
+
+```json
+{
+    "id": 1,
+    "type": "roundrobin",
+    "nodes": [
+        {"host": "1.1.1.1", "weight": 1},
+        {"host": "1.1.1.2", "weight": 1}
+    ]
+}
+```
+
+注意所有来自 `test.consul.service` 的 IP 都有相同的权重。
+
+如果一个服务同时有 A 和 AAAA 记录,那么 A 记录的优先级更高。

Review comment:
       I would appreciate it if you make supplement on the document in English before I update it?
   
   https://github.com/apache/apisix/blame/master/docs/en/latest/discovery/dns.md#L69




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org