Spring Zuul服务器空列表

2024-05-20 20:25:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前已经设置了一个springbootzuul服务器、一个springbooteureka服务器和一个Python Flask微服务。你知道吗

python微服务在注册和向springboot Eureka服务器发送心跳方面没有问题,甚至出现在http://localhost:8761/的“Instances currently registered with Eureka”下

这个问题发生在我启动Zuul服务器(打开了eager-loading)并得到这个结果时

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地址?你知道吗

谢谢你!你知道吗


Tags: ofname服务器clientlocalhostformystats