.NET Core open source API Gateway - Ocelot Chinese Documents
Ocelot is implemented in a .NET Core and open source API Gateway, it is powerful, including: routing, aggregation request, service discovery, authentication, authorization, limiting fuse, and built-in load balancer and Service Fabric, Butterfly Tracing integrated. These functions only require only a simple configuration can be completed, we will have the following functions one by one these configuration instructions.
Introduction
Simply put pipeline Ocelot is a bunch of asp.net core middleware component. When it is used after the get request is a request builder to construct a real server HttpRequestMessage sent to the downstream, and the like after another downstream service response returned by the middleware a map it to the return HttpResponseMessage HttpResponse.
Gateway API - it is a system exposed to externally access entry. This little guy like proxy access, as a company guard bear addressing, restricted access, security check, location guide, and more.
The basic use of Ocelot
Using a web service to host Ocelot, where there is a json configuration file, which set all the current configuration of the gateway. It receives all client requests, and the server route to the corresponding downstream processing, then the request returns the result. And this request on the downstream correspondence relationship is also called routing.
Integrated Identity Server
When we relate to certification and authentication, we can combine with Identity Server. When the gateway needs to request authentication information will interact with the Identity Server server to complete.
Gateway cluster
Only one gateway is very dangerous, that is, we often speak of a single point, as long as it hung up, all the services trailer. This obviously can not achieve high availability, so we can also deploy multiple gateways. Of course, this time in front of multiple gateways, you also need a load balancer.
Consul Service Discovery
Ocelot has the support of a simple load function, that is, when there are multiple nodes downstream services, Ocelot able to assume the role of load balancing. But it does not provide health checks, registration service can only be done by manually adding the configuration file inside. This is not flexible enough and there will be a certain degree of risk. This time we can use the service to do the Consul found it the perfect combination with Ocelot.
Integration Gateway
In asp.net core 2.0 years to complete the integration by nuget, or the command line dotnet add package Ocelot Ocelot nuget and add references are available through vs2017 UI.