Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Notes on SpringCloud-- Service Governance Mechanism

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

SpringCloud-- service governance mechanism note service governance mechanism

Service provider

Service registration

When starting up, the service provider registers itself with the Eureka Server by sending a REST request, along with some metadata information about its own service.

Eureka.client.register-with-eureka=true: start the registration operation

Service synchronization

Service renewal

Eureka.instance.lease-renewal-interval-in-seconds=30: used to define the interval between calls for service renewal tasks. Default is 30 seconds.

Eureka.instance.lease-expiration-duration-in-seconds=90: used to define the service expiration time. Default is 90 seconds.

Service consumers

Get servic

Service invocation

Service offline

Service registry

Failure elimination

Self-protection

Eureka.server.enable-self-preservation=false: turn off the protection mechanism (ensure that the registry can correctly weed out unavailable instances)

Source code analysis

DiscoveryClient class

This class is used to help collaborate with Eureka Server.

Eureka Client is responsible for the following tasks:

Register a service instance with Eureka Server to lease an Eureka Server service when the service is shut down, cancel the lease with Eureka Server to query the list of service instances in Eureka Server

Eureka Client also needs to configure a URL list of Eureka Server

Region 、 Zone

ServiceUrls

Service registration

Service acquisition and service renewal

Service registry processing

Configuration details

The configuration of the Eureka client is mainly divided into the following two aspects:

Configuration information related to service registration, including the address of the service registry, the interval between service acquisition, available areas, and so on. Configuration information related to the service instance, including the name, IP address, port number, health check path, etc.

Note: the "self-protection" function of the registry is turned off by setting the enableSelfPreservation parameter in this class to prevent the closed instance from being excluded by the service registry.

Designated registry

Eureka.client.serviceUrl.defaultZone= http://localhost:1111/eureka/

Or

Eureka.client.serviceUrl.defaultZone= http://peer1:1111/eureka/,http://peer2:1112/eureka/

Safety check

Http://:@localhost:1111/eureka/

The user name and password of the security verification information respectively

Other configuration

Service instance class configuration

Meta data

It is an object that Eureka clients use to describe their service information when sending registration requests to the service registry, including some standardized metadata, such as service name, instance name, instance IP, instance port and other important information for service governance, as well as some custom metadata information eureka.instance.metadataMap.zone=shanghai for load balancing policies or other special purposes.

Instance name configuration

Endpoint configuration

Health monitoring

Other configuration

Cross-platform support for communication protocols

A little.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report