spring-cloud / spring-cloud/spring-cloud-netflix

eureka: improve single-server experience

Open
#4,251 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

for team discussion
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:

Screenshot 2024-02-09 at 13 51 21

Workaround: myUrl: http://localhost:8761/eureka/
Screenshot 2024-02-09 at 13 50 28

UI Error with workaround unless you add enableSelfPreservation: false

Screenshot 2024-02-09 at 14 20 39

UI Error when you add enableSelfPreservation: false

Screenshot 2024-02-09 at 14 27 33

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.