Apache ShenYu Docker#
Java 原生API网关,用于服务代理、协议转换和API治理
Docker#
Run Apache ShenYu Admin#
docker network create shenyu
docker run -d --name shenyu-admin -p 9095:9095 --net shenyu apache/shenyu-admin
User: admin / 123456
Run Apache ShenYu Bootstrap#
docker run -d -p 9195:9195 -e "shenyu.local.enabled=true" --net shenyu apache/shenyu-bootstrap
docker run -d --name shenyu-bootstrap -p 9195:9195 -e "shenyu.local.enabled=true" -e SHENYU_SYNC_WEBSOCKET_URLS=ws://shenyu-admin:9095/websocket --net shenyu apache/shenyu-bootstrap
Set router#
curl --location --request POST 'http://localhost:9195/shenyu/plugin/selectorAndRules' \
--header 'Content-Type: application/json' \
--header 'localKey: 123456' \
--data-raw '{
"pluginName": "divide",
"selectorHandler": "[{\"upstreamUrl\":\"127.0.0.1:8080\"}]",
"conditionDataList": [{
"paramType": "uri",
"operator": "match",
"paramValue": "/**"
}],
"ruleDataList": [{
"ruleHandler": "{\"loadBalance\":\"random\"}",
"conditionDataList": [{
"paramType": "uri",
"operator": "match",
"paramValue": "/**"
}]
}]
}'