Eureka is part of the Spring Cloud Netflix Micro suite of services can be built with Springboot micro-services easily integrate.
Eureka includes server and client components. Server, also referred to as a service registry, to the registration and discovery service. Eureka supports high availability configuration, when the film took part in the cluster fails, Eureka will turn automatic protection mode, which allows fault during fragmentation continues to provide discovery and registration services, when the fault slices back to normal, cluster other fragments will synchronize their state back again.
The client component includes service consumers and service producers. In the application is running, Eureka client registers its own service provided to the registry and periodically sends a heartbeat to update its service lease. But also you can query the information currently registered service from the server and cache them locally and periodically refresh the service status.
Create an empty project:
Add-on:
By Spring Initializr initialization:
Basic Information module:
Add Eureka Server features:
Confirmation:
We create the project:
Edit startup class, add @EnableEurekaServer notes:
Edit the configuration file, add the following configuration properties:
Eureka-Server = spring.application.name
# service registry port number
server.port = 8080
# service registry instance hostname
eureka.instance.hostname = localhost
# whether to register themselves to the service registry
eureka.client.register-with = false -eureka
# whether retrieval services
eureka.client.fetch-registry = false
configure content # service registry, specify the location of a service registry
eureka.client.serviceUrl.defaultZone = http: // $ {eureka.instance.hostname }: $ {server.port} / eureka /
Start the program, open the registry Eureka Server URL: HTTP: // localhost: 8080 / , the following page (be careful to open the final URL without / eureka /, otherwise it will report a 404 error !!):
Last Instance Info in ipAddr show ip address of the server running Eureka Server