Microservices configuration properties
Posted By : Winkle Jindal | 31-Jul-2018
Eureka Server-
Eureka server is a service discovery implementation, where every Microservice is registered. Every client Microservice looks up Eureka server to get a dependent service to get the job done.
Every Microservice register itself in Eureka server. Generally using its {ServiceId} it register into Eureka server or there are some other scenarios of registering Microservices like -it can use any public IP(If those are Fixed) or hostname. After registering, IN every 30 seconds Microservices pings Eureka server to notify that the service itself is available. If server does not get any ping from a service for a long time than that service is automatically unregistered from Eureka server and Eureka Server notifies the new state of the registry to all other services.
While developing microservices we have to add configuration in application.yml so that Eureka server can understand which type of setup is required. Here are some of the name and meaning of properties.
Server properties-
1.spring.application.name= Declare a unique name for Eureka server service.
2.eureka.client.serviceUrl.defaultZone= it allows other Eureka servers to sync the Eureka server. if it is in standalone mode, give the local server address.
3.eureka.client.register-with-eureka= This property determines that server will sync with registry itself or not. as we all know server also can works as a client so it can sync the registry. the value false means to prevents a server from acting as a client.
4.eureka.client.fetch-registry= Does not register itself in the service registry.
5.eureka.client.enabled= Flag to indicate that the Eureka client is enabled.
6.eureka.client.eureka-server-read-timeout-seconds= Indicates how long to wait (in seconds) before a read from Eureka server needs to timeout.
7.eureka.instance.hostname= the hostname eureka advertises
8.eureka.instance.metadataMap.instanceId= instance unique id
9.eureka.instance.ip-address=Get the IPAdress of the instance.
10.eureka.instance.health-check-url=Gets the absolute health check page URL for this instance.
11.eureka.instance.secure-port-enabled=Indicates whether the secure port should be enabled for traffic or not.
12.eureka.server.waitTimeInMsWhenSyncEmpty= If we declare it as false, doing this after a while the killed service disappears as expected.
13.server.address= Network address to which the server should bind to.
14.server.port= It defines in which port server will be bound.
15.server.context-path= Context path of the application.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Winkle Jindal
Winkle is masters in computer application.She is currently working as Java Developer. she is quick learner and always passionate to learn new technologies.