-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
12 changed files
with
186 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
FATE-Serving 之间的交互可以通过nginx反向代理转发grpc请求,以下几种场景配置如下: | ||
|
||
* 场景一:双方不配置TLS,通过nginx四层代理转发 | ||
![场景一](../img/nginx_1.jpg) | ||
|
||
* 场景二:双方配置TLS,通过nginx四层代理转发,双方分别进行证书校验 | ||
![场景二](../img/nginx_2.jpg) | ||
|
||
* 场景三:数据使用方配置Client端证书,Nginx配置Server端证书,Host不配置证书,通过nginx七层代理转发,由Client端和nginx进行证书校验 | ||
![场景三](../img/nginx_3.jpg) | ||
|
||
四层代理转发配置 | ||
```editorconfig | ||
stream { | ||
log_format proxy '$remote_addr [$time_local] ' | ||
'$protocol $status $bytes_sent $bytes_received ' | ||
'$session_time "$upstream_addr" ' | ||
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; | ||
upstream next_rollsite { | ||
hash $remote_addr consistent; | ||
server 127.0.0.1:8869; # 转发到下游服务的地址 | ||
} | ||
server { | ||
listen 8443; # nginx 监听端口 | ||
proxy_connect_timeout 8s; | ||
proxy_timeout 24h; | ||
proxy_pass next_rollsite; | ||
} | ||
} | ||
``` | ||
|
||
七层代理转发配置 | ||
```editorconfig | ||
http { | ||
server { | ||
listen 8443 ssl http2; # gRPC基于HTTP/2 | ||
server_name localhost; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # 证书协议类型 | ||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!DH:!DHE:!RC4:!MD5:!NULL:!aNULL; | ||
ssl_certificate ssl/server.crt; # 证书文件 | ||
ssl_certificate_key ssl/server.key; # 私钥 | ||
ssl_session_cache shared:SSL:10m; | ||
ssl_session_timeout 5m; | ||
ssl_verify_client on; | ||
ssl_prefer_server_ciphers on; | ||
ssl_client_certificate ssl/ca.crt; # 根证书 | ||
location / { | ||
grpc_pass grpc://127.0.0.1:8869; # 转发到下游服务的地址 | ||
error_page 502 = /error502grpc; # 错误页面 | ||
} | ||
location = /error502grpc { | ||
internal; | ||
default_type application/grpc; | ||
add_header grpc-status 14; | ||
add_header grpc-message "unavailable"; | ||
return 204; | ||
} | ||
} | ||
} | ||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,77 @@ | ||
## fate-serving-client命令行工具 | ||
FATE-Serving提供了fate-serving-client工具进行 下载系统对应版本fate-serving-client: | ||
>linux版本:fate-serving-client-2.1.0-linux.tar.gz | ||
>mac版本:fate-serving-client-2.1.0-darwin.tar.gz | ||
在终端中使用`./fate-serving-client`启动, 默认情况下,client连接localhost:8000,使用参数可以指定目标地址`./fate-serving-client [-h host] [-p port] `host为需要连接的serving-server的ip , port 为serving-server对外暴露的端口。 | ||
>./fate-serving-client -h 127.0.0.1 -p 8000 | ||
![connect](../img/client_connect.jpg) | ||
|
||
提供了以下几种指令: | ||
|
||
* showconfig 查看服务配置 | ||
![showconfig](../img/client_showconfig.jpg) | ||
|
||
|
||
* showmodel 查看已发布的模型信息 | ||
![showmodel](../img/client_showmodel.jpg) | ||
|
||
|
||
* inference 在线单笔预测,参数为参数文件路径,如: | ||
>inference /data/projects/request.json | ||
/data/projects/request.json文件的内容为: | ||
```json | ||
{ | ||
"serviceId": "lr-test", | ||
"featureData": { | ||
"x0": 0.100016, | ||
"x1": 1.21, | ||
"x2": 2.321, | ||
"x3": 3.432, | ||
"x4": 4.543, | ||
"x5": 5.654, | ||
"x6": 5.654, | ||
"x7": 0.102345 | ||
}, | ||
"sendToRemoteFeatureData": { | ||
"id": "8" | ||
} | ||
} | ||
``` | ||
|
||
|
||
* batchInference 在线批量预测,参数为参数文件路径,如: | ||
>batchInference /data/projects/request.json | ||
/data/projects/request.json 的内容为: | ||
```json | ||
{ | ||
"serviceId": "lr-test", | ||
"batchDataList": [ | ||
{ | ||
"index": 0, | ||
"featureData": { | ||
"x0": 0.4853, | ||
"x1": 1.1996, | ||
"x2": -1.574, | ||
"x3": -0.8811, | ||
"x4": -0.6176, | ||
"x5": 0.5997, | ||
"x6": -0.5361, | ||
"x7": -0.1189, | ||
"x8": -1.5728 | ||
}, | ||
"sendToRemoteFeatureData": { | ||
"device_id": "299", | ||
"phone_num": 585 | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
* help 查看帮助信息 | ||
> help | ||
* quit 关闭连接 | ||
> quit |