SylviaBABY commented on code in PR #7094: URL: https://github.com/apache/apisix/pull/7094#discussion_r879092228
########## docs/zh/latest/discovery/zookeeper.md: ########## @@ -0,0 +1,148 @@ +--- +title: zookeeper +keywords: + - APISIX + - Zookeeper + - apisix-seed +description: 本篇文档介绍了如何使用 Zookeeper 做服务发现 +--- + +<!-- +# +# 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. +# +--> + +## 基于 [Zookeeper](https://zookeeper.apache.org/) 的服务发现 + +`Zookeeper` 服务发现需要依赖 [apisix-seed](https://github.com/api7/apisix-seed) 项目 + +### `apisix-seed` 工作原理 + + + +`apisix-seed` 通过同时监听 `etcd` 和 `zookeeper` 的变化来完成数据交换。 + +流程如下: + +1. `APISIX` 注册一个上游服务,并将服务类型设置为 `zookeeper` 并保存到 `etcd`。 +2. `apisix-seed` 监听 `etcd` 中 `APISIX` 的资源变更并过滤服务发现类型获得服务名称。 +3. `apisix-seed` 将服务绑定到 `etcd` 资源,并开始在 `zookeeper` 监听此服务。 +4. 客户端向 `zookeeper` 注册该服务。 +5. `apisix-seed` 获得 `zookeeper` 中的服务变更。 +6. `apisix-seed` 通过服务名称查询绑定的 `etcd` 资源,并将更新的服务节点写回 `etcd`。 +7. `APISIX` 工作节点监听 `etcd` 资源变更并在内存中刷新服务节点信息。 + +### 配置 `apisix-seed` 和 `Zookeeper` Review Comment: ```suggestion ## 如何使用 ### 环境准备:配置 `apisix-seed` 和 Zookeeper ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
