> docker pull apache/shenyu-admin > docker network create shenyu
h2
来存储后台数据:> docker run -d -p 9095:9095 --net shenyu apache/shenyu-admin
> docker network create shenyu > docker pull apache/shenyu-bootstrap > docker run -d -p 9195:9195 --net shenyu apache/shenyu-bootstrap
{ "name" : "Shenyu", "data" : "hello world" }
curl --location --request POST 'http://localhost:9195/shenyu/plugin/selectorAndRules' \ --header 'Content-Type: application/json' \ --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": "/**" }] }] }'
{ "name" : "Shenyu", "data" : "hello world" }
无论请求何时进入,ShenYu 会通过响应链执行所有已打开的插件。
插件是 ShenYu 的灵魂,并且插件也是可扩展和热插拔的。
不同的插件实现不同的功能。
当然,用户也可以定制化插件去满足他们自己的需求。
如果你有定制化插件的需求,请参看这里:custom-plugin
选择器和规则会根据 HTTP 的请求头来路由你的请求。
选择器是你的第一个路由,它是粗粒度的,举个例子,模块级别。
规则是你的第二个路由,即你认为你的请求应该做什么,举个例子,模块中的方法级别。
选择器和规则只匹配一次,然后返回匹配。因此,最粗粒度应排在最后。
所有的数据都被缓存在 JVM 的 ConcurrentHashMap 中,所以它非常快。
当用户在后台界面改变配置信息时,ShenYu 通过监听 ZooKeeper node,WebSocket push,HTTP longPull 来动态更新缓存。
为了便于登记,欢迎已经使用了 ShenYu 的公司在 https://github.com/apache/shenyu/issues/68 注册。(仅适用于开源用户)
所有用户 : Known Users