You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/12/14 02:24:17 UTC
[GitHub] [apisix] guoqqqi opened a new pull request #5793: docs: sync stream proxy Chinese version
guoqqqi opened a new pull request #5793:
URL: https://github.com/apache/apisix/pull/5793
### What this PR does / why we need it:
1. sync stream proxy Chinese version
Ref PR #5783
### Pre-submission checklist:
<!--
Please follow the requirements:
1. Use Draft if the PR is not ready to be reviewed
2. Test is required for the feat/fix PR, unless you have a good reason
3. Doc is required for the feat PR
4. Use a new commit to resolve review instead of `push -f`
5. Use "request review" to notify the reviewer once you have resolved the review
-->
* [x] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [x] Have you modified the corresponding document?
* [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
--
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] tzssangglass commented on a change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r771894926
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受四层(流式)连接的 APISIX 服务器的地址。
+- server_port: 接受四层(流式)连接的 APISIX 服务器的端口。
Review comment:
yes
--
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] guoqqqi commented on a change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r770206789
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -92,6 +96,68 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
例子中 APISIX 会把服务器地址为 `127.0.0.1`, 端口为 `2000` 代理到上游地址 `127.0.0.1:1995`。
+让我们再举一个实际场景的例子:
+
+1. 将此配置放在 `config.yaml` 中
+
+ ```yaml
+ apisix:
+ stream_proxy: # TCP/UDP proxy
+ tcp: # TCP proxy address list
+ - 9100 # by default uses 0.0.0.0
+ - "127.0.0.10:9101"
+ ```
+
+2. 现在运行一个 mysql docker 容器并将端口 3306 暴露给主机
+
+ ```shell
+ $ docker run --name mysql -e MYSQL_ROOT_PASSWORD=toor -p 3306:3306 -d mysql
+ # check it using a mysql client that it works
+ $ mysql --host=127.0.0.1 --port=3306 -u root -p
+ Enter password:
+ Welcome to the MySQL monitor. Commands end with ; or \g.
+ Your MySQL connection id is 25
+ ...
+ mysql>
+ ```
+
+3. 现在我们将创建一个带有服务器过滤的 stream 路由:
+
+ ```shell
+ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+ {
+ "server_addr": "127.0.0.10",
+ "server_port": 9101,
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:3306": 1
+ },
+ "type": "roundrobin"
+ }
+ }'
+ ```
+
+ 每当 APISIX 服务器 `127.0.0.10` 和端口 `9101` 收到连接时,它只会将请求转发到 mysql 上游。让我们测试一下:
+
+4. 向 `9100` 发出请求(在 config.yaml 中启用 stream 代理端口),过滤器匹配失败。
+
+ ```shell
+ $ mysql --host=127.0.0.1 --port=9100 -u root -p
+ Enter password:
+ ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
Review comment:
Sorry, I'm not clear on this, I've just updated the English part here, Do you have any good advice?
--
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 merged pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #5793:
URL: https://github.com/apache/apisix/pull/5793
--
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] guoqqqi commented on a change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r771772056
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受四层(流式)连接的 APISIX 服务器的地址。
+- server_port: 接受四层(流式)连接的 APISIX 服务器的端口。
Review comment:
Should I change the `四层(流式)` to `Stream Route`?
--
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 change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r771032513
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受四层(流式)连接的 APISIX 服务器的地址。
+- server_port: 接受四层(流式)连接的 APISIX 服务器的端口。
Review comment:
Hi @tzssangglass, should we use `四层(流式)` or `Stream Route`?
--
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 change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r768325134
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -147,7 +147,7 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
```
- Instead making a request to the APISIX host and port where the filter matching succeeds:
+ 而给 APISIX 的主机和端口发出请求,过滤器匹配成功。
Review comment:
Not too sure 🤔 cc @tzssangglass
--
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] tzssangglass commented on a change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r771114198
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受四层(流式)连接的 APISIX 服务器的地址。
+- server_port: 接受四层(流式)连接的 APISIX 服务器的端口。
Review comment:
`Stream Route` +1, because the above is also not translated, it is best to unify.
--
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 change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r768272773
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受 L4 连接的 APISIX 服务器的地址。
Review comment:
```suggestion
- server_addr: 接受四层(流式)连接的 APISIX 服务器的地址。
```
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -92,6 +96,68 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
例子中 APISIX 会把服务器地址为 `127.0.0.1`, 端口为 `2000` 代理到上游地址 `127.0.0.1:1995`。
+让我们再举一个实际场景的例子:
+
+1. 将此配置放在 `config.yaml` 中
+
+ ```yaml
+ apisix:
+ stream_proxy: # TCP/UDP proxy
+ tcp: # TCP proxy address list
+ - 9100 # by default uses 0.0.0.0
+ - "127.0.0.10:9101"
+ ```
+
+2. 现在运行一个 mysql docker 容器并将端口 3306 暴露给主机
+
+ ```shell
+ $ docker run --name mysql -e MYSQL_ROOT_PASSWORD=toor -p 3306:3306 -d mysql
+ # check it using a mysql client that it works
+ $ mysql --host=127.0.0.1 --port=3306 -u root -p
+ Enter password:
+ Welcome to the MySQL monitor. Commands end with ; or \g.
+ Your MySQL connection id is 25
+ ...
+ mysql>
+ ```
+
+3. 现在我们将创建一个带有服务器过滤的 stream 路由:
+
+ ```shell
+ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+ {
+ "server_addr": "127.0.0.10",
+ "server_port": 9101,
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:3306": 1
+ },
+ "type": "roundrobin"
+ }
+ }'
+ ```
+
+ 每当 APISIX 服务器 `127.0.0.10` 和端口 `9101` 收到连接时,它只会将请求转发到 mysql 上游。让我们测试这种行为:
Review comment:
```suggestion
每当 APISIX 服务器 `127.0.0.10` 和端口 `9101` 收到连接时,它只会将请求转发到 mysql 上游。我们测试一下:
```
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受 L4 连接的 APISIX 服务器的地址。
+- server_port: 接受 L4 连接的 APISIX 服务器的端口。
Review comment:
```suggestion
- server_port: 接受四层(流式)连接的 APISIX 服务器的端口。
```
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -72,7 +72,11 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
## 更多 route 匹配选项
-我们可以添加更多的选项来匹配 route。
+我们可以添加更多的选项来匹配 route。目前 stream 路由配置支持 3 个字段进行过滤:
+
+- server_addr: 接受 L4 连接的 APISIX 服务器的地址。
+- server_port: 接受 L4 连接的 APISIX 服务器的端口。
+- remote_addr: 发出请求的客户地址。
Review comment:
```suggestion
- remote_addr: 发出请求的客户端地址。
```
##########
File path: docs/zh/latest/admin-api.md
##########
@@ -985,11 +985,11 @@ $ curl "http://127.0.0.1:9080/apisix/admin/plugins/key-auth" -H 'X-API-KEY:
| 名字 | 可选项| 类型 | 说明 | 示例 |
| ---------------- | ------| -------- | ------| -----|
-| remote_addr | 可选 | IP/CIDR | 客户端 IP 地址 | "127.0.0.1/32" 或 "127.0.0.1" |
-| server_addr | 可选 | IP/CIDR | 服务端 IP 地址 | "127.0.0.1/32" 或 "127.0.0.1" |
-| server_port | 可选 | 整数 | 服务端端口 | 9090 |
-| sni | 可选 | Host | 服务器名称指示| "test.com" |
| upstream | 可选 | Upstream | 启用的 Upstream 配置,详见 [Upstream](architecture-design/upstream.md) | |
| upstream_id | 可选 | Upstream | 启用的 upstream id,详见 [Upstream](architecture-design/upstream.md) | |
+| remote_addr | 可选 | IP/CIDR | 过滤选项:如果客户端 IP 匹配,则转发到上游 | "127.0.0.1/32" 或 "127.0.0.1" |
+| server_addr | 可选 | IP/CIDR | 过滤选项:如果 APISIX 服务器 IP 与 server_addr 匹配,则转发到上游 | "127.0.0.1/32" 或 "127.0.0.1" |
+| server_port | 可选 | 整数 | 过滤选项:如果 APISIX 服务器 port 与 server_port 匹配,则转发到上游 | 9090 |
+| sni | 可选 | Host | 服务器名称指示| "test.com" |
Review comment:
https://github.com/apache/apisix/pull/5783/files#diff-de04caa451665cf4137cdde9804ab1f53de08dedd08fc3d51a2143bb18d46f71R987
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -92,6 +96,68 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
例子中 APISIX 会把服务器地址为 `127.0.0.1`, 端口为 `2000` 代理到上游地址 `127.0.0.1:1995`。
+让我们再举一个实际场景的例子:
+
+1. 将此配置放在 `config.yaml` 中
+
+ ```yaml
+ apisix:
+ stream_proxy: # TCP/UDP proxy
+ tcp: # TCP proxy address list
+ - 9100 # by default uses 0.0.0.0
+ - "127.0.0.10:9101"
+ ```
+
+2. 现在运行一个 mysql docker 容器并将端口 3306 暴露给主机
+
+ ```shell
+ $ docker run --name mysql -e MYSQL_ROOT_PASSWORD=toor -p 3306:3306 -d mysql
+ # check it using a mysql client that it works
+ $ mysql --host=127.0.0.1 --port=3306 -u root -p
+ Enter password:
+ Welcome to the MySQL monitor. Commands end with ; or \g.
+ Your MySQL connection id is 25
+ ...
+ mysql>
+ ```
+
+3. 现在我们将创建一个带有服务器过滤的 stream 路由:
+
+ ```shell
+ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+ {
+ "server_addr": "127.0.0.10",
+ "server_port": 9101,
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:3306": 1
+ },
+ "type": "roundrobin"
+ }
+ }'
+ ```
+
+ 每当 APISIX 服务器 `127.0.0.10` 和端口 `9101` 收到连接时,它只会将请求转发到 mysql 上游。让我们测试这种行为:
+
+4. 向 `9100` 发出请求(在 config.yaml 中启用 stream 代理端口),过滤器匹配失败。
+
+ ```shell
+ $ mysql --host=127.0.0.1 --port=9100 -u root -p
+ Enter password:
+ ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
+ ```
+
+ Instead making a request to the APISIX host and port where the filter matching succeeds:
Review comment:
i18n?
--
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] tzssangglass commented on a change in pull request #5793: docs: sync stream proxy Chinese version
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #5793:
URL: https://github.com/apache/apisix/pull/5793#discussion_r769189003
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -147,7 +147,7 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
```
- Instead making a request to the APISIX host and port where the filter matching succeeds:
+ 而给 APISIX 的主机和端口发出请求,过滤器匹配成功。
Review comment:
I see, here seems a little unclear.
Here we can express: the following request matches stream route 1, so it can be proxied to mysql normally.
##########
File path: docs/zh/latest/stream-proxy.md
##########
@@ -92,6 +96,68 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03
例子中 APISIX 会把服务器地址为 `127.0.0.1`, 端口为 `2000` 代理到上游地址 `127.0.0.1:1995`。
+让我们再举一个实际场景的例子:
+
+1. 将此配置放在 `config.yaml` 中
+
+ ```yaml
+ apisix:
+ stream_proxy: # TCP/UDP proxy
+ tcp: # TCP proxy address list
+ - 9100 # by default uses 0.0.0.0
+ - "127.0.0.10:9101"
+ ```
+
+2. 现在运行一个 mysql docker 容器并将端口 3306 暴露给主机
+
+ ```shell
+ $ docker run --name mysql -e MYSQL_ROOT_PASSWORD=toor -p 3306:3306 -d mysql
+ # check it using a mysql client that it works
+ $ mysql --host=127.0.0.1 --port=3306 -u root -p
+ Enter password:
+ Welcome to the MySQL monitor. Commands end with ; or \g.
+ Your MySQL connection id is 25
+ ...
+ mysql>
+ ```
+
+3. 现在我们将创建一个带有服务器过滤的 stream 路由:
+
+ ```shell
+ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+ {
+ "server_addr": "127.0.0.10",
+ "server_port": 9101,
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:3306": 1
+ },
+ "type": "roundrobin"
+ }
+ }'
+ ```
+
+ 每当 APISIX 服务器 `127.0.0.10` 和端口 `9101` 收到连接时,它只会将请求转发到 mysql 上游。让我们测试一下:
+
+4. 向 `9100` 发出请求(在 config.yaml 中启用 stream 代理端口),过滤器匹配失败。
+
+ ```shell
+ $ mysql --host=127.0.0.1 --port=9100 -u root -p
+ Enter password:
+ ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
Review comment:
Is there any special output in the apisix logs at the time of this error?
--
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