Closed Xlinlin closed 4 years ago
I can only guess. Looks like you got the wrong dns name.
@GetMapping(value = "/v1/catalog/service/{appName}", produces = MediaType.APPLICATION_JSON_VALUE)
public Single<ResponseEntity<List<Service>>> getService(@PathVariable("appName") String appName,
@QueryParam(QUERY_PARAM_WAIT) String wait,
@QueryParam(QUERY_PARAM_INDEX) Long index) {
Assert.isTrue(appName != null, "service name can not be null");
Single<ChangeItem<List<InstanceInfo>>> service = registrationService.getService(appName, getWaitMillis(wait), index);
return registrationService.getService(appName, getWaitMillis(wait), index)
.map(item -> {
List<Service> services = item.getItem().stream().map(instanceInfoMapper::map).collect(toList());
// docker swarm,use instance id(dns)
if (dockerSwarm) {
services.forEach(service1 -> {
**String serviceId = service1.getServiceID();
String[] split = serviceId.split(":");
service1.setAddress(split[0]);
service1.setServiceAddress(serviceId);**
});
}
return createResponseEntity(services, item.getChangeIndex());
});
}
But,I got another error: Eureka: w.s.m.s.DefaultHandlerExceptionResolver Resolved [org.springframework.web.context.request.async.AsyncRequestTimeoutException]
Promethus: level=error ts=2020-06-09T06:35:26.433Z caller=consul.go:487 component="discovery manager scrape" discovery=consul msg="Error refreshing service" service=SWARM-CONSUMER tags= err="Unexpected response code: 503 ({\"timestamp\":\"2020-06-09T06:35:26.432+0000\",\"status\":503,\"error\":\"Service Unavailable\",\"message\":\"No message available\",\"path\":\"/v1/health/service/SWARM-CONSUMER\"}
Have a look at the required timeout configuration in the Readme.
Thanks
Deploy eureka and promethus into Docker swarm, prometheus error msg:
dial tcp: lookup swarm-eureka on 127.0.0.11:53: no such host