mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-03 20:47:35 +08:00
doc: added chinese doc for stream proxy.
This commit is contained in:
parent
791fe6982e
commit
7adcea69fb
@ -58,8 +58,8 @@ APISIX 通过插件机制,提供动态负载平衡、身份验证、限流限
|
||||
- **IdP 支持**: 支持外部的身份认证服务,比如 Auth0,okta 等,用户可以借此来对接 Oauth2.0 等认证方式。
|
||||
- **[单机模式](doc/stand-alone-cn.md)**: 支持从本地配置文件中加载路由规则,在 kubernetes(k8s) 等环境下更友好。
|
||||
- **全局规则**:允许对所有请求执行插件,比如黑白名单、限流限速等。
|
||||
- **[TCP/UDP 代理](doc/stream-proxy.md)**: 动态 TCP/UDP 代理。
|
||||
- **[动态 MQTT 代理](doc/plugins/mqtt-proxy.md)**: 支持用 `client_id` 对 MQTT 进行负载均衡,同时支持 MQTT [3.1.*](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html) 和 [5.0](https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html) 两个协议标准。
|
||||
- **[TCP/UDP 代理](doc/stream-proxy-cn.md)**: 动态 TCP/UDP 代理。
|
||||
- **[动态 MQTT 代理](doc/plugins/mqtt-proxy-cn.md)**: 支持用 `client_id` 对 MQTT 进行负载均衡,同时支持 MQTT [3.1.*](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html) 和 [5.0](https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html) 两个协议标准。
|
||||
- **ACL**: TODO。
|
||||
- **Bot detection**: TODO。
|
||||
|
||||
|
63
doc/stream-proxy-cn.md
Normal file
63
doc/stream-proxy-cn.md
Normal file
@ -0,0 +1,63 @@
|
||||
[English](stream-proxy.md)
|
||||
|
||||
# Stream 代理
|
||||
|
||||
众多的闻名的应用和服务,像 LDAP、 MYSQL 和 RTMP ,选择 TCP 作为通信协议。 但是像 DNS、 syslog 和 RADIUS 这类非事务性的应用,他们选择了
|
||||
UDP协议。
|
||||
|
||||
APISIX 可以对 TCP/UDP 协议进行代理并实现动态负载均衡。 在 nginx 世界,称 TCP/UDP 代理为 stream 代理,在 APISIX 这里我们也遵循了这个声明.
|
||||
|
||||
## 如何开启 Stream 代理?
|
||||
|
||||
在 `conf/config.yaml` 配置文件设置 `stream_proxy` 选项, 指定一组需要进行动态代理的IP地址。默认情况不开启stream代理。
|
||||
|
||||
```
|
||||
apisix:
|
||||
stream_proxy: # TCP/UDP proxy
|
||||
tcp: # TCP proxy address list
|
||||
- 9100
|
||||
- 127.0.0.1:9101
|
||||
udp: # UDP proxy address list
|
||||
- 9200
|
||||
- 127.0.0.1:9211
|
||||
```
|
||||
|
||||
## 如何设置 route ?
|
||||
|
||||
简例如下:
|
||||
|
||||
```shell
|
||||
curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -X PUT -d '
|
||||
{
|
||||
"remote_addr": "127.0.0.1",
|
||||
"upstream": {
|
||||
"nodes": {
|
||||
"127.0.0.1:1995": 1
|
||||
},
|
||||
"type": "roundrobin"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
例子中 APISIX 对客户端IP为 127.0.0.1`的请求代理转发到上游主机 `127.0.0.1:1995`
|
||||
|
||||
更多用例,请参照 [test case](../t/stream-node/sanity.t).
|
||||
|
||||
## 更多限制选项
|
||||
|
||||
我们可以添加更多的选项来匹配 route ,例如
|
||||
|
||||
```shell
|
||||
curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -X PUT -d '
|
||||
{
|
||||
"server_addr": "127.0.0.1",
|
||||
"server_port": 2000,
|
||||
"upstream": {
|
||||
"nodes": {
|
||||
"127.0.0.1:1995": 1
|
||||
},
|
||||
"type": "roundrobin"
|
||||
}
|
||||
}'
|
||||
```
|
||||
例子中 APISIX 把上游地址 `127.0.0.1:1995` 代理成地址为 `127.0.0.1`, 端口为 `2000`
|
@ -1,3 +1,5 @@
|
||||
[中文](stream-proxy-cn.md)
|
||||
|
||||
# Stream Proxy
|
||||
|
||||
TCP is the protocol for many popular applications and services, such as LDAP, MySQL, and RTMP. UDP (User Datagram Protocol) is the protocol for many popular non-transactional applications, such as DNS, syslog, and RADIUS.
|
||||
|
@ -2,9 +2,16 @@
|
||||
|
||||
set -ex
|
||||
|
||||
OR_EXEC=`which openresty`
|
||||
OR_EXEC=`which openresty 2>&1`
|
||||
echo $OR_EXEC
|
||||
|
||||
# check the openresty exist
|
||||
CHECK_OR_EXIST=`echo $OR_EXEC | grep ": no openresty" | wc -l`
|
||||
if [ $CHECK_OR_EXIST -eq 1 ];then
|
||||
echo "can not find the openresty, install failed"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
LUA_JIT_DIR=`TMP='./v_tmp' && $OR_EXEC -V &>$${TMP} && cat $${TMP} | grep prefix | grep -Eo 'prefix=(.*?)/nginx' | grep -Eo '/.*/' && rm $${TMP}`
|
||||
LUA_JIT_DIR="${LUA_JIT_DIR}luajit"
|
||||
echo $LUA_JIT_DIR
|
||||
|
Loading…
Reference in New Issue
Block a user