.NetCore Ocelot
参考:https://www.cnblogs.com/fanfan-90/p/16157053.html
参考:https://blog.51cto.com/u_13746169/5876532
Nuget包:
Ocelot
Ocelot.Provider.Consul
Ocelot.Provider.Polly
Ocelot.Cache.CacheManager
程序包管理器控制台CLI
Install-Package Ocelot -Version 16.0.1
Install-Package Ocelot.Provider.Consul -Version 16.0.1
Install-Package Ocelot.Provider.Polly -Version 16.0.1
Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design -Version 16.0.1
Install-Package Microsoft.Extensions.Caching.Memory -Version 3.1.6
Install-Package Microsoft.Extensions.Caching.Abstractions -Version 3.1.6
Install-Package IdentityServer4.AccessTokenValidation -Version 3.0.1
Install-Package MMLib.SwaggerForOcelot -Version 2.5.1
Ocelot集群参考:
https://blog.51cto.com/u_15162069/2755105
Consul 安装教程:https://blog.csdn.net/heyl163_/article/details/131729216
Consul 下载地址:https://developer.hashicorp.com/consul/downloads
https://www.cnblogs.com/ff2223/p/17757321.html
https://tool.4xseo.com/a/8264.html#google_vignette
负载均衡:https://i.cnblogs.com/posts/edit;postId=17836599
Ocelot之自身负载、网关限流、缓存和熔断机制
https://www.cnblogs.com/yaopengfei/p/13307065.html
1.注意项目启动和注册的地址是否一致
参考:https://www.cnblogs.com/gongzi/p/16985104.html
consul agent -server -ui -bootstrap-expect=1 -data-dir=D:\consul_1.17.0_windows_amd64 -node=127.0.0.1 -client=0.0.0.0 -bind=127.0.0.1 -datacenter=dc1 -join 127.0.0.1
2.注册服务
3.设置网关启动端口
"applicationUrl"
:
"http://127.0.0.1:5000"
,
后台启动,前端没有UI:app.Urls.Add("https://*:
5001
");
4.应用服务设置心跳
5.访问:http://localhost:5000/SA/WeatherForecast
ocelot第一步配置(配置文件到数据库中)
https://www.cnblogs.com/mykcode/p/11910329.html