当前位置:网站首页>(1) ASP.NET Introduction to core3.1 Ocelot
(1) ASP.NET Introduction to core3.1 Ocelot
2020-11-06 01:32:26 【itread01】
1. Introduction
Ocelot It was originally designed to be associated with .NET Core Used together , It's a .NET API Gate runner , As usage oriented .NET Perform microservices / Service oriented architecture requires a unified system entry point , That is, when the client (Web Site , Cell phones APP) Etc Web API When ,Ocelot As a unified entry point, it will be distributed to the corresponding API Go to the website ( Address ). and Ocelot It also integrates a lot of features , Example routing , Certification , Authorization , Speed limit and other function points ,Ocelot The official website also suggests that authentication should be followed by authentication (IdentityServer4) Use it together , Easy integration of bearer tokens . You can go to the official website for details (https://ocelot.readthedocs.io/en/latest/introduction/bigpicture.html) Get to know .
And examine Ocelot Source code , We will see Ocelot It's a bunch of intermediary software in a specific order (Middleware) The pipes that make up .
Ocelot Will HttpRequest The object operates to the state specified by its configuration , Until it reaches the request builder mediation Software , In mediation software, it creates a HttpRequestMessage thing , This object is used to make requests to downstream Services . The intermediary request is made by the software Ocelot The last thing in the pipeline . It doesn't call the next intermediary . Responses from downstream services are stored in the repository for each request scope , And ask to return Ocelot When the pipeline is retrieved . There is a piece of intermediary software that will HttpResponseMessage It's mapped to HttpResponse thing , It is then returned to the client .
2.Ocelot To configure
According to the official website ,Ocelot There are five configurations :
2.1 Basic integration (Basic Implementation)
When a client visits a downstream service site , Will be unified through Ocelot Gate runner ,Ocelot Gate runner Host The host will first read configuration.json Configuration information , According to the configuration file to find the corresponding downstream service site and return the processing results to the client . This process can be called routing addressing .
2.2 Integrate IdentityServer(With IdentityServer)
When the service site involves authentication and Authorization , It can be done through Ocelot Integrated on the gate IdentityServer, When a client visits a downstream service site , Will pass first IdentityServer After authentication and authorization, they are distributed to downstream service sites .
2.3 Multiple gateways are clustered (Multiple Instances)
Single Ocelot The gate is dangerous , If this gateway goes down , All downstream service sites will be inaccessible , It is impossible to achieve high availability in this way . To solve this problem , You can deploy multiple Ocelot Gateway clustering , and Ocelot Also integrated with load balancer .
2.4 Integrate Consul Service discovery (With Consul)
Check the official website file load balancing column , We know Ocelot Simple load function has been supported , When there are multiple service nodes in the downstream site ,Ocelot Can take on the role of load balancing . But it doesn't provide health checks , The service registration can only be completed by manually adding in the configuration file . It's not flexible enough and there are risks to some extent . At this time we can use Consul To do service discovery , It can relate to Ocelot Perfect combination .
2.5 Integrate Service Fabric(With Service Fabric)
If you are in Service Fabric Central government has a service , The naming service is usually used to access them .
3. Summary
Ocelot The gateway is the system's only access to the outside world , It's like the company's doorman is responsible for addressing 、 Access restrictions 、 Safety check 、 Location guidance and other functions . It also provides routing , Authentication 、 Monitoring 、 Load balancing 、 Get it 、 Request fragmentation and management 、 Static response processing and other functions .Ocelot The key point of the gateway is , All clients and consumers access microservices through a unified gateway , All non business functions are handled at the gateway level . Usually the gateway also provides REST/HTTP Access to API, The server registers and manages services through the gateway . After that chapter , I will continue to base on GitHub Contributors open source projects Ocelot Demo The example describes its functions .Ocelot Demo Address https://github.com/catcherwong-archive/APIGatewayDemo.
References :
Ocelot Official website
版权声明
本文为[itread01]所创,转载请带上原文链接,感谢
边栏推荐
- C++ 数字、string和char*的转换
- C++学习——centos7上部署C++开发环境
- C++学习——一步步学会写Makefile
- C++学习——临时对象的产生与优化
- C++学习——对象的引用的用法
- C++编程经验(6):使用C++风格的类型转换
- Won the CKA + CKS certificate with the highest gold content in kubernetes in 31 days!
- C + + number, string and char * conversion
- C + + Learning -- capacity() and resize() in C + +
- C + + Learning -- about code performance optimization
猜你喜欢
-
C + + programming experience (6): using C + + style type conversion
-
Latest party and government work report ppt - Park ppt
-
在线身份证号码提取生日工具
-
Online ID number extraction birthday tool
-
️野指针?悬空指针?️ 一文带你搞懂!
-
Field pointer? Dangling pointer? This article will help you understand!
-
HCNA Routing&Switching之GVRP
-
GVRP of hcna Routing & Switching
-
Seq2Seq实现闲聊机器人
-
【闲聊机器人】seq2seq模型的原理
随机推荐
- LeetCode 91. 解码方法
- Seq2seq implements chat robot
- [chat robot] principle of seq2seq model
- Leetcode 91. Decoding method
- HCNA Routing&Switching之GVRP
- GVRP of hcna Routing & Switching
- HDU7016 Random Walk 2
- [Code+#1]Yazid 的新生舞会
- CF1548C The Three Little Pigs
- HDU7033 Typing Contest
- HDU7016 Random Walk 2
- [code + 1] Yazid's freshman ball
- CF1548C The Three Little Pigs
- HDU7033 Typing Contest
- Qt Creator 自动补齐变慢的解决
- HALCON 20.11:如何处理标定助手品质问题
- HALCON 20.11:标定助手使用注意事项
- Solution of QT creator's automatic replenishment slowing down
- Halcon 20.11: how to deal with the quality problem of calibration assistant
- Halcon 20.11: precautions for use of calibration assistant
- “十大科学技术问题”揭晓!|青年科学家50²论坛
- "Top ten scientific and technological issues" announced| Young scientists 50 ² forum
- 求反转链表
- Reverse linked list
- js的数据类型
- JS data type
- 记一次文件读写遇到的bug
- Remember the bug encountered in reading and writing a file
- 单例模式
- Singleton mode
- 在这个 N 多编程语言争霸的世界,C++ 究竟还有没有未来?
- In this world of N programming languages, is there a future for C + +?
- es6模板字符
- js Promise
- js 数组方法 回顾
- ES6 template characters
- js Promise
- JS array method review
- 【Golang】️走进 Go 语言️ 第一课 Hello World
- [golang] go into go language lesson 1 Hello World