Eureka (registration, discovery, heartbeat)
Service Registration: will service information (service ID, IP, port, etc.) sent to the Server service startup registry.
Service discovery: to find the caller ID service that can be called by the Registry Server.
Heart rate monitor: service side periodically ( default 30 seconds ) to send a request to renew Server, if not receive the renewal request within 90 seconds, Server-side service will remove the information from the registry.
Eureka clusters
Compared with zk, Eureka no master, the registry is the relationship by copying each other synchronized manner.
When a station Eureka down request will automatically switch to the new node Eureka. Once down the server restarts, the Eureka will again automatically be included in the cluster.
Eureka cluster replication algorithm
https://blog.csdn.net/cyq12345_/article/details/78805303
Eureka self-protection mode
When network problems caused by micro-Eureka and service can not communicate (the service is normal), and this was not written off micro services, thus Eureka provides a self-protection mode to solve this problem, when the excessive loss of service nodes in a short time, then it will automatically go into self-protection mode, after entering this mode, Eureka will not write off any service when the network fault recovery, the node will automatically exit protected mode.
Protection mechanisms triggering conditions are:
expectedNumberOfRenewsPerMin (expected maximum number of updates per minute) = the number of currently registered application example 2 *
numberOfRenewsPerMinThreshold (minimum desired number of updates per minute) * Percentage renewal = expectedNumberOfRenewsPerMin (eureka.server.renewal-percent-threshold = 0.85)
assumed Examples 2, then is calculated as (2 * 2) * 0.85 , the minimum update number 3.4, 3 rounding.
Eureka default value is calculated once for 15 minutes at renewalThresholdUpdateIntervalMs (threshold update interval). If less than every 3 minutes over 15 minutes, then the node will enter the protected mode.
So why is the number of instances * 2, because the default is 30 seconds Eureka renewal, then that is twice per minute.
So if the parameters change the heartbeat monitoring time students there may be cases not trigger protection mechanisms will need to calculate based on the modified parameters.
The difference between Eureka and Zookeeper
Before we talk about the difference between a good idea to look at the CAP principle , no explanation here.
Zookeeper ensure CP
when found in the cluster will stop after the master down, and elections in the remaining node (the Internet that 30 ~ 120s, asked his colleagues not so long), final recovery services.
Eureka AP guarantee
failure when the service sends a request to the Server, the service will automatically switch to the other nodes, as long as there is still a start can guarantee available, only found in the registry may not be current. (Can not guarantee consistency).