spring cloud micro Services Architecture b2b2c e-commerce -Eureka protection mechanisms

First registry Eureka Eureka need to know is that each node is equal, there is no concept ZK role, even if the N-1 nodes hang it will not affect the normal operation of other nodes. Learn springcloud architecture can be added to beg: 3536247259

By default, if Eureka Server within a certain time (default 90 seconds) does not receive a heartbeat micro service instance, Eureka Server will remove the instance. But when the network partition failure occurs between the micro and the Eureka Server service can not communicate, and micro service itself is running at this time should not remove the micro-services, so the introduction of self-protection mechanism.

It is one for self-protection mode network security measures abnormal fluctuations, the use of self-protection mode allows more robust Eureka clusters, stable operation.

The working mechanism of self-protection mechanism is that if more than 85% within 15 minutes of client nodes do not have a normal heartbeat, then the client is considered Eureka and registration center of a network failure, Eureka Server automatically enter the self-protection mechanism, this time will the following situations:

1, Eureka Server no longer remove because for a long time and should not receive heartbeat expired registration service from the list.

2, Eureka Server will still be able to accept registration and query requests for new services, but will not be synchronized to the other nodes to ensure that the current node is still available.

3, when the network is stable, the current new registration information Eureka Server will be synchronized to the other nodes.

Therefore Eureka Server can well cope with the situation due to network failure resulting in some nodes lost contact, but not as if half the cases are not available will cause the entire cluster is unavailable and becomes paralyzed like ZK.

Self-protection switch
Eureka self-protection mechanism, by arranging eureka.server.enable-self-preservation to open the true / false disable self-protection mechanism, a default open state, the production environment is recommended open configuration.

Development environment configuration
development environment if you want to implement a service failure automatically removed only need to modify the following configuration.

1, the registration center closed self-protection mechanism, modified checking failed services.

eureka:
server:
  enable-self-preservation:false
   eviction-interval-timer-in-ms:3000

2, micro-services modification heartbeat service time shortened.

lease-expiration-duration-in-seconds:10
lease-renewal-interval-in-seconds:3

The above configuration recommended configuration in a production environment using the default time.

Guess you like

Origin blog.51cto.com/14622290/2466501