-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify peer replication setup of eureka servers #1251
Comments
I agree with your analysis of the documentation, I am interpreting it the same way. When you implement the above configuration what is the result on each peer? |
If all clients have the same property value:
peer1 and peer2 will have the full registry, and peer3 will be empty. |
So if each server has
peer3 is empty? What is the result when you have the configuration in your issue description above?
|
@william-tran @ryanjbaxter I am using this approach All three are showing the same information. Is that what is expected? |
@ryanjbaxter maybe I wasn't clear in my messages, I was describing the setup where the servers have this configuration
And the clients have
The clients are only sending requests to peer1 and have no need to fall back to peer2 or peer3. |
If the servers have this configuration:
Each peer knows the complete list of all peers, and so all peers will have the same information. Any client can use any peer and get the same up to date information. The point I'm trying to make is that this requirement is not clear in the documentation. |
OK makes more sense now. @spencergibb asked someone from the netflix OSS team to comment on the issue so lets see what the intended behavior is and then we can adjust the docs accordingly. |
netflix uses dns so their "static" list isn't truly static and can be updated eventually. |
From an architectural point of view, each eureka server needs to know all other peers for replication to fully work. Currently in eureka there are two methods exposed to allow for this, one via config (the method described above), and another via a txt type dns record that allows for a bit more flexibility (the txt based dns record can be changed dynamically and be picked up by the servers if configured to do so). |
Thanks for confirming that behaviour @qiangdavidliu. |
Some of the difference is that at netflix there is one eureka per zone, so peering happens accross zones. So clients in zone1 have the zone1 eureka first, then zones 2 & 3. Clients in zone 2 have zone 2 first then 1 & 3, etc... @qiangdavidliu tell me if I'm wrong. |
@spencergibb you are not wrong, though we have since moved away from a strict zonal configuration since. Today we run multiple eureka server per zone, and all eurekaClients can talk to any eureka server, however this is code that ensures clients in a zone preferentially connect to (a random) server in the same zone. |
@qiangdavidliu thanks for the update |
@william-tran based on what we know if we updated the docs to state something like
Would that be clearer? Welcome to suggestions... |
Example uses the same value of eureka.client.serviceUrl.defaultZone for all peers. The eureka server knows who it is and doesn't attempt to replicate to itself [1], so this simplification will work. [1]https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L616-L619
Clarify peer replication setup of eureka servers (Fixes #1251)
Closed via 4b40a45 |
@qiangdavidliu is it possible for you share an example repo for DNS based peer awareness across zones? |
Example uses the same value of eureka.client.serviceUrl.defaultZone for all peers. The eureka server knows who it is and doesn't attempt to replicate to itself [1], so this simplification will work. [1]https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L616-L619 Cherry picked from commit 4b40a45
Example uses the same value of eureka.client.serviceUrl.defaultZone for all peers. The eureka server knows who it is and doesn't attempt to replicate to itself [1], so this simplification will work. [1]https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L616-L619 Cherry picked from commit 4b40a45
Example uses the same value of eureka.client.serviceUrl.defaultZone for all peers. The eureka server knows who it is and doesn't attempt to replicate to itself [1], so this simplification will work. [1]https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L616-L619 Cherry picked from commit 4b40a45
In order for peer replication to work properly, all eureka servers need to know about all other peers. Given servers peer1, peer2, peer3, this won't work.
This is because a server receiving a peer replication request will not further replicate that request to the other peers it knows about: https://github.com/Netflix/eureka/blob/v1.4.10/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L610 This can result peers having different views and leases expiring because a particular peer hasn't received the heartbeats it was expecting from a client.
This passage in the docs seems to suggest that the above setup would be sufficient though:
The text was updated successfully, but these errors were encountered: