eureka: improve single-server experience
codefromthecrypt opened this issue · 0 comments
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