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 2022/05/20 14:59:34 UTC
[GitHub] [apisix] penghuima opened a new pull request, #7094: add zookeeper
penghuima opened a new pull request, #7094:
URL: https://github.com/apache/apisix/pull/7094
Signed-off-by: penghuima <29...@qq.com>
### Description
add zookeeper
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [ ] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change
- [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
<!--
Note
1. Mark the PR as draft until it's ready to be reviewed.
2. Always add/update tests for any changes unless you have a good reason.
3. Always update the documentation to reflect the changes made in the PR.
4. Make a new commit to resolve conversations instead of `push -f`.
5. To resolve merge conflicts, merge master instead of rebasing.
6. Use "request review" to notify the reviewer after making changes.
7. Only a reviewer can mark a conversation as resolved.
-->
--
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
[GitHub] [apisix] juzhiyuan commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r882286603
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 APISIX 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
Review Comment:
```suggestion
通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 Zookeeper 作为服务发现,服务名称为 `APISIX-ZK`。
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
Review Comment:
Actually, we should use `;` instead of `。` in the list
--
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
[GitHub] [apisix] penghuima commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
penghuima commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1141324881
I'm still not sure when to use Zookeeper or ZooKeeper in this document,please help me.
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879093403
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
Review Comment:
The paraphrase also needs to be translated
--
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
[GitHub] [apisix] hf400159 commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r880023665
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,146 @@
+---
+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.
+#
+-->
+
+目前,想在 APISIX 中基于 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+返回结果如下:
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+### 请求验证
+
+通过以下命令请求路由:
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+进行请求响应:
Review Comment:
```suggestion
正常返回结果:
```
--
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
[GitHub] [apisix] hf400159 commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r880099170
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
Review Comment:
```suggestion
### 设置 APISIX 路由和上游
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
Review Comment:
```suggestion
[zk: localhost:2181(CONNECTED) 0]create /zookeeper/APISIX-ZK '{"host":"127.0.0.1","port":1980,"weight":100}'
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879084919
##########
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` 的变化来完成数据交换。
Review Comment:
```suggestion
`apisix-seed` 通过同时监听 etcd 和 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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879096437
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
Review Comment:
```suggestion
返回结果如下:
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879097884
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+- 响应
Review Comment:
```suggestion
请求响应如下所示。
```
--
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
[GitHub] [apisix] lunarwhite commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
lunarwhite commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1139211003
> If it involves this kind of official exclusive term, you need confirm it first and then modify it.
Perhaps we could add this rule to the doc style guide?
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879096936
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
Review Comment:
```suggestion
### 请求验证
通过以下命令请求路由:
```bash
curl -i http://127.0.0.1:9080/zk/hello
```
```
--
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
[GitHub] [apisix] spacewander commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
spacewander commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1144504546
@juzhiyuan
Please take a look. Thanks!
--
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
[GitHub] [apisix] juzhiyuan merged pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
juzhiyuan merged PR #7094:
URL: https://github.com/apache/apisix/pull/7094
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879063929
##########
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` 的资源变更并过滤服务发现类型获得服务名称。
Review Comment:
```suggestion
2. `apisix-seed` 监听 etcd 中 APISIX 的资源变化,过滤服务发现类型并获取服务名称。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879084367
##########
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/) 的服务发现
+
Review Comment:
```suggestion
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] hf400159 commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r880021073
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,146 @@
+---
+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.
+#
+-->
+
+目前,想在 APISIX 中基于 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
Review Comment:
```suggestion
3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,146 @@
+---
+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.
+#
+-->
+
+目前,想在 APISIX 中基于 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+返回结果如下:
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+### 请求验证
+
+通过以下命令请求路由:
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+进行请求响应:
+
+```bash
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/html; charset=utf-8
+Date: Tue, 29 Mar 2022 08:51:28 GMT
+Server: APISIX/2.12.0
+Transfer-Encoding: chunked
Review Comment:
不需要全部的返回结果,仅给出有用的信息就可以了。
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,146 @@
+---
+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.
+#
+-->
+
+目前,想在 APISIX 中基于 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 Zookeeper
+
+1. 启动 Zookeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 Zookeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # Zookeeper 节点默认权重设为 100
+ timeout: 10 # Zookeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+返回结果如下:
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+### 请求验证
+
+通过以下命令请求路由:
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+进行请求响应:
+
+```bash
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/html; charset=utf-8
+Date: Tue, 29 Mar 2022 08:51:28 GMT
+Server: APISIX/2.12.0
+Transfer-Encoding: chunked
Review Comment:
```suggestion
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,146 @@
+---
+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.
+#
+-->
+
+目前,想在 APISIX 中基于 Zookeeper 进行服务发现,需要依赖 [apisix-seed](https://github.com/api7/apisix-seed) 项目进行。
Review Comment:
```suggestion
目前,如果你想在 APISIX 控制面使用 Zookeeper 实现服务发现功能,需要依赖 [apisix-seed](https://github.com/api7/apisix-seed) 项目。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879088458
##########
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` 资源变更并在内存中刷新服务节点信息。
Review Comment:
```suggestion
3. `apisix-seed` 将服务绑定到 etcd 资源,并开始在 Zookeeper 中监控此服务。
4. 客户端向 Zookeeper 注册该服务。
5. `apisix-seed` 获取 Zookeeper 中的服务变更。
6. `apisix-seed` 通过服务名称查询绑定的 etcd 资源,并将更新后的服务节点写入 etcd。
7. APISIX Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879097884
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+- 响应
Review Comment:
```suggestion
进行请求响应:
```
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+- 响应
+
+```bash
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/html; charset=utf-8
+Date: Tue, 29 Mar 2022 08:51:28 GMT
+Server: APISIX/2.12.0
+Transfer-Encoding: chunked
+...
+hello
+```
Review Comment:
```suggestion
```
通过上述返回结果,可以看到 APISIX 已经成功发现并将请求转发到了注册的服务节点上。
```
--
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
[GitHub] [apisix] penghuima commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
penghuima commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1139212698
copy that
--
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
[GitHub] [apisix] hf400159 commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r885127804
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 ZooKeeper
+
+1. 启动 ZooKeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 ZooKeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # ZooKeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # ZooKeeper 节点默认权重设为 100
+ timeout: 10 # ZooKeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 APISIX 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
Review Comment:
please refer: https://zookeeper.apache.org/doc/current/zookeeperCLI.html
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 ZooKeeper
+
+1. 启动 ZooKeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 ZooKeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # ZooKeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # ZooKeeper 节点默认权重设为 100
+ timeout: 10 # ZooKeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 APISIX 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
Review Comment:
please refer: https://zookeeper.apache.org/doc/current/index.html
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 ZooKeeper
+
+1. 启动 ZooKeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 ZooKeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # ZooKeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # ZooKeeper 节点默认权重设为 100
+ timeout: 10 # ZooKeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 APISIX 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
Review Comment:
```suggestion
使用 ZooKeeper-cli 注册服务
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,142 @@
+---
+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.
+#
+-->
+
+目前,如果你想在 APISIX 控制面使用 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 Worker 监控 etcd 资源变更,并在内存中刷新服务节点信息。
+
+## 如何使用
+
+### 环境准备:配置 `apisix-seed` 和 ZooKeeper
+
+1. 启动 ZooKeeper
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 参考以下信息修改 `apisix-seed` 配置文件,路径为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX etcd 配置
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # 配置 ZooKeeper 进行服务发现
+ hosts:
+ - "127.0.0.1:2181" # ZooKeeper 服务器地址
+ prefix: /zookeeper
+ weight: 100 # ZooKeeper 节点默认权重设为 100
+ timeout: 10 # ZooKeeper 会话超时时间默认设为 10 秒
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 APISIX 路由和上游
+
+通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
Review Comment:
```suggestion
登录 ZooKeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
```
--
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
[GitHub] [apisix] hf400159 commented on a diff in pull request #7094: add zookeeper
Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r878632276
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,143 @@
+---
+title: 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` 。
Review Comment:
```suggestion
1. `APISIX` 注册一个上游服务,并将服务类型设置为 `zookeeper` 并保存到 `etcd`。
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,143 @@
+---
+title: zookeeper
+---
Review Comment:
please add keywords and description. please refer: [installation ](https://github.com/apache/apisix/blob/master/docs/zh/latest/installation-guide.md)
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,143 @@
+---
+title: 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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由, 请求路径为 `/zk/*`, 上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# Login Container
+docker exec -it ${CONTAINERID} /bin/bash
+# Login Zookeeper Client
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# Register Service
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
+
+```bash
+curl -i http://127.0.0.1:9080/zk/hello
+```
+
+- 响应
+
+```bash
+HTTP/1.1 200 OK
+Connection: keep-alive
+Content-Type: text/html; charset=utf-8
+Date: Tue, 29 Mar 2022 08:51:28 GMT
+Server: APISIX/2.12.0
+Transfer-Encoding: chunked
Review Comment:
```suggestion
...
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,143 @@
+---
+title: 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` 。
Review Comment:
```suggestion
6. `apisix-seed` 通过服务名称查询绑定的 `etcd` 资源,并将更新的服务节点写回 `etcd`。
```
##########
docs/zh/latest/discovery/zookeeper.md:
##########
@@ -0,0 +1,143 @@
+---
+title: 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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由, 请求路径为 `/zk/*`, 上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# Login Container
Review Comment:
need translat
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879062762
##########
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) 项目
Review Comment:
```suggestion
目前,想在 APISIX 中基于 Zookeeper 进行服务发现,需要依赖 [apisix-seed](https://github.com/api7/apisix-seed) 项目进行。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879084719
##########
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` 工作原理
Review Comment:
```suggestion
## `apisix-seed` 工作原理
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879063929
##########
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` 的资源变更并过滤服务发现类型获得服务名称。
Review Comment:
```suggestion
2. `apisix-seed` 监听 etcd 中 APISIX 的资源变更,并过滤服务发现类型获得服务名称。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879064322
##########
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`。
Review Comment:
```suggestion
1. 使用 APISIX 注册一个上游服务,并将服务类型设置为 `zookeeper` 并保存到 etcd。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879099006
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
Review Comment:
```suggestion
### 注册服务
1. 使用 `Zookeeper CLI` 注册服务
登录 Zookeeper 容器,使用 CLI 程序进行服务注册。具体命令如下:
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879096161
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
Review Comment:
```suggestion
### 注册服务
登录 Zookeeper Docker 容器,使用 CLI 程序进行服务注册。具体命令如下:
```bash
# 登陆容器
docker exec -it ${CONTAINERID} /bin/bash
# 登陆 Zookeeper 客户端
oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
# 注册服务
[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
```
```
--
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
[GitHub] [apisix] SylviaBABY commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1139241407
> > If it involves this kind of official exclusive term, you need confirm it first and then modify it.
>
> Perhaps we could add this rule to the doc style guide?
In the Chinese doc guide, we have added special descriptions but not many. If you think it's a common misused specific word, then you can add in (i.e BookKeeper\ZooKeeper, or other words you think also need to be specially marked).
<img width="633" alt="image" src="https://user-images.githubusercontent.com/39793568/170622481-9bd771db-2c98-485b-8bbb-157731ccf6d8.png">
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879095382
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
Review Comment:
```suggestion
### 注册服务
登录 Zookeeper Docker 容器,使用 CLI 程序进行服务注册。具体命令如下:
```bash
# 登陆容器
docker exec -it ${CONTAINERID} /bin/bash
# 登陆 Zookeeper 客户端
oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
# 注册服务
[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
```
返回结果如下:
```bash
Created /zookeeper/APISIX-ZK
```
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879097467
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
+
+```bash
+# 登陆容器
+docker exec -it ${CONTAINERID} /bin/bash
+# 登陆 Zookeeper 客户端
+oot@ae2f093337c1:/apache-zookeeper-3.7.0-bin# ./bin/zkCli.sh
+# 注册服务
+[zk: localhost:2181(CONNECTED) 0] create /zookeeper/APISIX-ZK '{"host":"127.0.0.1:1980","weight":100}'
+```
+
+- 响应成功
+
+```bash
+Created /zookeeper/APISIX-ZK
+```
+
+2. 请求验证
+
+- 请求
Review Comment:
```suggestion
### 请求验证
通过以下命令请求路由:
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879094078
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
Review Comment:
```suggestion
通过以下命令设置路由,请求路径设置为 `/zk/*`,上游使用 ZooKeeper 作为服务发现,服务名称为 `APISIX-ZK`。
```
--
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
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879092581
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
Review Comment:
```suggestion
1. 启动 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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7094:
URL: https://github.com/apache/apisix/pull/7094#discussion_r879099006
##########
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`
+
+配置步骤如下:
+
+1. 启动 `Zookeeper` 服务
+
+```bash
+docker run -itd --rm --name=dev-zookeeper -p 2181:2181 zookeeper:3.7.0
+```
+
+2. 下载并编译 `apisix-seed` 项目
+
+```bash
+git clone https://github.com/api7/apisix-seed.git
+cd apisix-seed
+go build
+```
+
+3. 修改 `apisix-seed` 配置文件,路径设为 `conf/conf.yaml`
+
+```bash
+etcd: # APISIX ETCD Configure
+ host:
+ - "http://127.0.0.1:2379"
+ prefix: /apisix
+ timeout: 30
+
+discovery:
+ zookeeper: # Zookeeper Service Discovery
+ hosts:
+ - "127.0.0.1:2181" # Zookeeper service address
+ prefix: /zookeeper
+ weight: 100 # default weight for node
+ timeout: 10 # default 10s
+```
+
+4. 启动 `apisix-seed` 以监听服务变更
+
+```bash
+./apisix-seed
+```
+
+### 设置 `APISIX` 路由和上游
+
+设置一个路由,请求路径为 `/zk/*`,上游使用 `zookeeper` 作为服务发现,服务名称是 `APISIX-ZK`
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
+{
+ "uri": "/zk/*",
+ "upstream": {
+ "service_name": "APISIX-ZK",
+ "type": "roundrobin",
+ "discovery_type": "zookeeper"
+ }
+}'
+```
+
+### 注册服务和请求验证
+
+1. 使用 `Zookeeper CLI` 注册服务
+
+- 注册服务
Review Comment:
```suggestion
### 注册服务
1. 使用 `Zookeeper CLI` 注册服务
登录 Zookeeper Docker 容器,使用 CLI 程序进行服务注册。具体命令如下:
```
--
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
[GitHub] [apisix] SylviaBABY commented on pull request #7094: docs: add zookeeper CN document
Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on PR #7094:
URL: https://github.com/apache/apisix/pull/7094#issuecomment-1138313517
@penghuima I saw you have changed all ZooKeeper to Zookeeper. Actually, if you google it you will find on the official website with the standard description
<img width="666" alt="image" src="https://user-images.githubusercontent.com/39793568/170454077-76ee555d-d6d2-46bf-a578-ef482b78489c.png">
--
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