The Eureka server is the service registry in a Spring Cloud system. Each microservice instance registers its name, host, port and health URL with Eureka, renews that registration with periodic heartbeats, and asks Eureka where other services currently run. This removes hardcoded addresses, so instances can start, stop and scale without clients being reconfigured.
Eureka comes from Netflix and is packaged for Spring as Spring Cloud Netflix Eureka. Only the Eureka registry and client are used today. The older Netflix Ribbon load balancer was removed from Spring Cloud, and client-side load balancing is now done by Spring Cloud LoadBalancer.
Eureka is a REST-based registry that follows the client-side discovery pattern. It holds a map of service names to running instances and exposes it over HTTP and a small dashboard.
| Responsibility | How Eureka handles it |
|---|---|
| Registration | A client sends its instance metadata (app name, host, port, status, health check URL) when it starts. |
| Renewal | The client sends a heartbeat every 30 seconds by default to say it is alive. |
| Eviction | If the server receives no heartbeat for 90 seconds by default, it removes the instance. |
| Discovery | Clients fetch the registry, cache it locally and refresh the cache about every 30 seconds. |
| Cancellation | A client that shuts down cleanly deregisters itself. |
The server is not a proxy. Traffic flows directly from one service to another, so the registry is not in the request path and a brief registry outage does not stop calls between services that have cached each other's addresses.
Create a Spring Boot project and add the Eureka server starter. Use the Spring Cloud release train that matches your Spring Boot version, and import it through the Spring Cloud BOM.
Enable the server with one annotation on the main class.
A standalone server should not try to register with itself, so turn that off in application.yml.
Start the application and open http://localhost:8761. The dashboard lists registered instances, their status and the server's self-preservation state.
Any service that should be discovered adds the client starter and points to the registry.
With the starter on the classpath, registration is automatic. The @EnableDiscoveryClient annotation is optional in current Spring Cloud versions. The spring.application.name value becomes the service ID that other services use to find this one.
A caller resolves the logical service name instead of a host. With Spring Cloud LoadBalancer on the classpath, a @LoadBalanced client picks one registered instance for each request.
The host inventory-service is not DNS. The load balancer replaces it with the address of a live instance taken from the Eureka registry.
Eureka favours availability over strict consistency. If many heartbeats stop at once, for example because of a network partition, the server may be the one that is cut off and the instances may still be healthy. To avoid deleting a healthy registry, Eureka enters self-preservation mode when the number of renewals falls below a threshold (85 percent of the expected number by default). In this mode it stops evicting instances and the dashboard shows a warning.
The consequence is that clients can receive the address of an instance that is really gone. Calls should therefore use timeouts, retries and circuit breakers, for example with Resilience4j. During local development you can disable the behaviour so that dead instances disappear quickly.
Keep self-preservation enabled in production.
A production registry runs as several peers that replicate to each other. Each server registers with the others, and each client lists more than one URL.
Peers replicate registrations asynchronously, so the registry is eventually consistent. Place peers in different availability zones. Secure the endpoint with Spring Security (HTTP basic is common) and put the credentials in the defaultZone URL of the clients.
Eureka is a good fit for a plain Spring Boot fleet on virtual machines or containers. On Kubernetes, the platform already provides discovery through Services and DNS, and Spring Cloud Kubernetes can read it, so a separate registry is usually unnecessary. HashiCorp Consul and Apache ZooKeeper are alternative registries supported by Spring Cloud.
No. It only stores and serves the list of instances. The client chooses an instance, usually with Spring Cloud LoadBalancer.
@EnableDiscoveryClient?Not in current Spring Cloud versions. Adding a discovery client starter to the classpath is enough to register the application.
Eureka waits for the lease to expire (90 seconds by default), and self-preservation mode can keep entries longer. A graceful shutdown deregisters the instance immediately.
Yes, the underlying Netflix Eureka 1.x server is a standalone WAR, but Spring Cloud gives you auto-configuration, security integration and Boot packaging.
The Eureka server is the registry that lets Spring Boot microservices find each other by name. Clients register, send heartbeats and cache the registry, while a client-side load balancer picks an instance per call. Run several peers for availability, keep self-preservation on, protect the endpoint, and design callers to tolerate stale entries.