我怀疑这是一个问题,任何人都可以帮忙检查一下吗?一旦关闭,Spring云端服务器无法注销nodeJS服务
在我的Sidecar应用程序,我有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 is 30, recommended to keep default
metadataMap:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
在我的主弹簧配置应用程序,我有:
String url_node = "";
try {
InstanceInfo instance = discoveryClient.getNextServerFromEureka("nodeservice", false);
// InstanceInfo instance = discoveryClient.getNextServerFromEureka("foo", false);
url_node = instance.getHomePageUrl();
} catch (Exception e) {
}
现在我开始我的服务器的NodeJS,我在春天应用:
网址nodeService是:http://SJCC02MT0NUFD58.local:3000/
这是PERF等,但在我关闭我的nodeJS服务器后, http://localhost:3000/app/health.json url完全失效,但在主要的java spring应用程序中,我仍然看到相同的输出。
因此,即使NodeJS服务不再可用,尤里卡仍然记得在内存中。
我的配置有什么问题吗?
另一个问题是为什么春季发现的网址是http://SJCC02MT0NUFD58.local:3000/而不是http://localhost:3000?我已经将Eureka.server.instance.host配置为localhost。
感谢
谢谢@spencergibb,在你看来,这也是真的,nodeServer的URL,http://SJCC02MT0NUFD58.local:3000 /,即使我已经把localhost放在sideCar配置中也是需要的吗?这只适用于mac吗? – user3006967
默认情况下,Spring云使用主机名。 – spencergibb