Spring cloud sidecar can not un-register nodeJS service once it is shut down -
i suspect issue, can have check?
in sidecar application, have application.yml:
server: port: 5678 spring: application: name: nodeservice sidecar: port: ${nodeserver.instance.port:3000} health-uri: http://localhost:${nodeserver.instance.port:3000}/app/health.json eureka: instance: hostname: ${host.instance.name:localhost} leaserenewalintervalinseconds: 5 #default 30, recommended keep default metadatamap: instanceid: ${spring.application.name}:${spring.application.instance_id:${random.value}} client: serviceurl: defaultzone: http://localhost:8761/eureka/ and in main spring config app, have:
string url_node = ""; try { instanceinfo instance = discoveryclient.getnextserverfromeureka("nodeservice", false); // instanceinfo instance = discoveryclient.getnextserverfromeureka("foo", false); url_node = instance.gethomepageurl(); } catch (exception e) { } now start nodejs server, have in spring app:
url nodeservice is: http://sjcc02mt0nufd58.local:3000/
this perfect, after shutdown nodejs server, http://localhost:3000/app/health.json url totally down, but, in main java spring app, still see same output there.
so seemed if nodejs service no longer available, eureka still remembering in memory.
anything wrong configuration?
another question why url being discovered spring http://sjcc02mt0nufd58.local:3000/, not http://localhost:3000? configured eureka.server.instance.host localhost.
thanks
you seeing appropriate behavior. eureka , ribbon built resilient (ap in cap). in case described, service had @ least 1 instance, there none, ribbon eureka client keeps last know list of servers around last resort. you're printing names, if try connect service fail. use hystrix circuit breaker can provide fallback in case no instances up.
Comments
Post a Comment