DiscoveryClient 没有看到来自 Eureka 的服务
DiscoveryClient does not see a service from Eureka
当我询问 eureka 它知道的服务时 (localhost:8071/eureka/apps/),它说 3 是 UP:
<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_3_</apps__hashcode>
<application>
<name>ROUTER</name>
<instance>
<instanceId>localhost:router:8765</instanceId>
<hostName>localhost</hostName>
<app>ROUTER</app>
<ipAddr>10.0.75.1</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8765</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502197927458</registrationTimestamp>
<lastRenewalTimestamp>1502198527594</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502197927458</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://localhost:8765/</homePageUrl>
<statusPageUrl>http://localhost:8765/info</statusPageUrl>
<healthCheckUrl>http://localhost:8765/health</healthCheckUrl>
<vipAddress>router</vipAddress>
<secureVipAddress>router</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502197927458</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502197825173</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>ORDERS</name>
<instance>
<instanceId>localhost:ORDERS:8081</instanceId>
<hostName>localhost</hostName>
<app>ORDERS</app>
<ipAddr>10.0.75.1</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8081</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502198168983</registrationTimestamp>
<lastRenewalTimestamp>1502198528945</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502198088982</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://localhost:8081/</homePageUrl>
<statusPageUrl>http://localhost:8081/info</statusPageUrl>
<healthCheckUrl>http://localhost:8081/health</healthCheckUrl>
<vipAddress>ORDERS</vipAddress>
<secureVipAddress>ORDERS</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502198168983</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502198168956</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>FRONTEND</name>
<instance>
<instanceId>32e1ed7e75ba:8080</instanceId>
<hostName>32e1ed7e75ba</hostName>
<app>FRONTEND</app>
<ipAddr>172.17.0.3</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8080</port>
<securePort enabled="false">7002</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502197928887</registrationTimestamp>
<lastRenewalTimestamp>1502198529372</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502197928887</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://32e1ed7e75ba:8080</homePageUrl>
<statusPageUrl>http://32e1ed7e75ba:8080/info</statusPageUrl>
<healthCheckUrl>http://32e1ed7e75ba:8080/health</healthCheckUrl>
<vipAddress>true</vipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502197928887</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502197928886</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
</applications>
但后来我问我的 ROUTER,它知道哪些(使用 https://spring.io/guides/gs/service-registration-and-discovery/ 中的 ServiceInstanceRestController)它说 2 - ROUTER 和 ORDER,但没有 FRONTEND。
有谁知道可能是什么原因吗?
作为提示,WEBFRONT 应用程序是带有 eureka 插件的 nodejs 应用程序。 ROUTER 和 ORDERS 都是 Boots。
显然 FRONTEND 正确注册并且 eureka 将其视为 UP。我逐行比较了 ORDERS 和 FRONTEND 的 eureka XML 输出,并没有发现任何关键差异...
我发现的一件事是前端服务的 vipAddress
字段,它是 true
,但我认为在您的情况下它应该是 FRONTEND
或 frontend
。因为在后台 EurekaDiscoveryClient
使用 com.netflix.discovery.EurekaClient getInstancesByVipAddress(String,bool)
函数 (source in the spring-cloud-netflix-eureka-client project),它通过 vipAddress
.
查询可用服务
更改后,您应该会在路由器服务 /service-instances/frontend
路径的响应中看到该服务。
当我询问 eureka 它知道的服务时 (localhost:8071/eureka/apps/),它说 3 是 UP:
<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_3_</apps__hashcode>
<application>
<name>ROUTER</name>
<instance>
<instanceId>localhost:router:8765</instanceId>
<hostName>localhost</hostName>
<app>ROUTER</app>
<ipAddr>10.0.75.1</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8765</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502197927458</registrationTimestamp>
<lastRenewalTimestamp>1502198527594</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502197927458</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://localhost:8765/</homePageUrl>
<statusPageUrl>http://localhost:8765/info</statusPageUrl>
<healthCheckUrl>http://localhost:8765/health</healthCheckUrl>
<vipAddress>router</vipAddress>
<secureVipAddress>router</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502197927458</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502197825173</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>ORDERS</name>
<instance>
<instanceId>localhost:ORDERS:8081</instanceId>
<hostName>localhost</hostName>
<app>ORDERS</app>
<ipAddr>10.0.75.1</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8081</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502198168983</registrationTimestamp>
<lastRenewalTimestamp>1502198528945</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502198088982</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://localhost:8081/</homePageUrl>
<statusPageUrl>http://localhost:8081/info</statusPageUrl>
<healthCheckUrl>http://localhost:8081/health</healthCheckUrl>
<vipAddress>ORDERS</vipAddress>
<secureVipAddress>ORDERS</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502198168983</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502198168956</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>FRONTEND</name>
<instance>
<instanceId>32e1ed7e75ba:8080</instanceId>
<hostName>32e1ed7e75ba</hostName>
<app>FRONTEND</app>
<ipAddr>172.17.0.3</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8080</port>
<securePort enabled="false">7002</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1502197928887</registrationTimestamp>
<lastRenewalTimestamp>1502198529372</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1502197928887</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://32e1ed7e75ba:8080</homePageUrl>
<statusPageUrl>http://32e1ed7e75ba:8080/info</statusPageUrl>
<healthCheckUrl>http://32e1ed7e75ba:8080/health</healthCheckUrl>
<vipAddress>true</vipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1502197928887</lastUpdatedTimestamp>
<lastDirtyTimestamp>1502197928886</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
</applications>
但后来我问我的 ROUTER,它知道哪些(使用 https://spring.io/guides/gs/service-registration-and-discovery/ 中的 ServiceInstanceRestController)它说 2 - ROUTER 和 ORDER,但没有 FRONTEND。
有谁知道可能是什么原因吗?
作为提示,WEBFRONT 应用程序是带有 eureka 插件的 nodejs 应用程序。 ROUTER 和 ORDERS 都是 Boots。 显然 FRONTEND 正确注册并且 eureka 将其视为 UP。我逐行比较了 ORDERS 和 FRONTEND 的 eureka XML 输出,并没有发现任何关键差异...
我发现的一件事是前端服务的 vipAddress
字段,它是 true
,但我认为在您的情况下它应该是 FRONTEND
或 frontend
。因为在后台 EurekaDiscoveryClient
使用 com.netflix.discovery.EurekaClient getInstancesByVipAddress(String,bool)
函数 (source in the spring-cloud-netflix-eureka-client project),它通过 vipAddress
.
更改后,您应该会在路由器服务 /service-instances/frontend
路径的响应中看到该服务。