我目前已经设置了Spring Boot Zuul服务器,Spring Boot Eureka服务器和Python Flask微服务。
python微服务注册没有问题,并且向Heart Boot Eureka Server发送心跳,甚至出现在http://localhost:8761/
的“当前已向Eureka注册的实例”下
当我启动Zuul服务器(打开紧急加载)并得到此消息时,就会发生此问题
DynamicServerListLoadBalancer for client myservice initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=myservice,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@446a5aa5
Zuul服务器能够找到自己的位置
DynamicServerListLoadBalancer for client 3102-ZUUL-SERVER initialized: DynamicServerListLoadBalancer: NFLoadBalancer:name=3102-ZUUL-SERVER,current list of Servers=[192.168.99.1:8762],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
我尝试使用Postman向http://localhost:8761/eureka/apps/
发送请求,并能够检索到如下所示的信息
<application>
<name>myservice</name>
<instance>
<instanceId>YOLO8889:8889</instanceId>
<hostName>localhost</hostName>
<app>myservice</app>
<ipAddr>localhost</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8889</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>1573932309374</registrationTimestamp>
<lastRenewalTimestamp>1573932959485</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1573932308869</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1573932309374</lastUpdatedTimestamp>
<lastDirtyTimestamp>1573932308869</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
由于list of Servers
为空,每次我尝试通过Zuul访问服务时,Zuul服务器都会引发异常Load balancer does not have available server for client
。
如何让Zuul为我的python服务选择IP地址?
谢谢!