spring-cloud / spring-cloud/spring-cloud-netflix
eureka: improve single-server experience
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5k
- Forks
- 2.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 10
Description
Is your feature request related to a problem? Please describe.
Right now, to configure a eureka server, you need to add several properties to try to inform its client config is self-directed.
e.g.
eureka:
client:
registerWithEureka: false
fetchRegistry: false
registryFetchIntervalSeconds: 1
Even when you do that, the UI will show the same node as an unavailable replica. It looks like this:
unavailable-replicas http://localhost:8761/eureka/,
The server shows up as a replica because the isThisMyUrl() host comparison is strict. For example, it doesn't check to see if the server is listening on all IPs, as usually the case unless spring's "server.address" property is set. So, it doesn't know that ultimately localhost:8761 must be the same instance as ${hostname}:8761 and marks it down. Note that this happens despite the registerWithEureka: false property as basically even if the "self replica" is dodged, it still believes it is one.
Describe the solution you'd like
I would like to set a property like dev/standalone mode and not have to set several properties and have log warnings or strange behavior in the UI.
Describe alternatives you've considered
One way is to see if upstream will make the isThisMyUrl soft, but I guess it can't at its layer of abstraction as it cannot know the underlying server framework like boot can.
Another is the current workaround, which is to set myUrl explicitly to the default value of the client. This is in addition to the several other properties needed for single server. However, this creates UI errors that are worse than the glitch of self being in the unavailable servers list.
eureka:
server:
# Match the default of eureka.client.serviceUrl.defaultZone, so that the UI
# Doesn't list this node twice, as an unavailable replica.
myUrl: http://localhost:8761/eureka/
logging:
level:
# don't warn that there are no replica nodes
com.netflix.eureka.cluster.PeerEurekaNodes: 'ERROR'
Additional context
Problem:
Workaround: myUrl: http://localhost:8761/eureka/
UI Error with workaround unless you add enableSelfPreservation: false
UI Error when you add enableSelfPreservation: false
Log warning with workaround unless you set com.netflix.eureka.cluster.PeerEurekaNodes: 'ERROR'
2024-02-09T14:24:03.021+07:00 WARN 20337 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : The replica size seems to be empty. Check the route 53 DNS Registry
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Eureka server configuration and the isThisMyUrl() host comparison described in the issue. Review how registerWithEureka, fetchRegistry, and the server myUrl properties affect replica detection. Done should provide a documented standalone mode that avoids redundant configuration, self-replica UI entries, and related warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, cloud, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100