2017-12-27 23 views
0

私はZuulとEurekaを使用してマイクロサービスに接続しようとしていましたが、serviceIdに基づいてZuulを経由して再ルーティングすることを除いてほとんど成功しました。私が持っているものは、Spring Boot ZuulとEurekaアプリケーション、Eurekaに登録するノードベースのマイクロサービスです。どちらもZuulとmicroserviceはユーレカに登録され、ユーレカのコントロールパネルに表示されている、しかし、私は次の例外を取得しmicroserviceにZuul経由でルーティングしようとすると:Zuulロードバランサにクライアント用のサーバがありません

IPによるルーティングが動作しているよう
com.netflix.zuul.exception.ZuulException: Forwarding error 
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: steam-auth-service 

、私はそれを必要としません。

Zuul application.properties:

server.port=8079 
eureka.client.service-url.defaultZone=http://localhost:8088/eureka 
zuul.routes.steam-auth-service.serviceId=steam-auth-service 
zuul.routes.steam-auth-service.path=/steam/** 

Node.jsのユーレカクライアント登録:

// Discovery service info 
const eurekaServer = { 
    host: process.env.EUREKA_HOST, 
    port: process.env.EUREKA_PORT, 
    servicePath: '/eureka/apps/', 
}; 

// Client to connect to Eureka discovery service 
const eurekaClient = new Eureka({ 
    instance: { 
    app: 'steam-auth-service', 
    hostName: 'localhost', 
    ipAddr: '127.0.0.1', 
    port: { 
     $: process.env.PORT, 
     '@enabled': true, 
    }, 
    vipAddress: 'steamauth.pubgtrade.com', 
    dataCenterInfo: { 
     '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo', 
     name: 'MyOwn', 
    }, 
    }, 
    eureka: eurekaServer, 
}); 

私が言ったように、両方のZuulアプリケーションとmicroservicesはユーレカに登録してに表示されていますコントロールパネル。

/ユーレカ/レスポンスをアプリ:

<applications> 
<versions__delta>1</versions__delta> 
<apps__hashcode>UP_2_</apps__hashcode> 
<application> 
<name>STEAM-AUTH-SERVICE</name> 
<instance> 
<hostName>localhost</hostName> 
<app>STEAM-AUTH-SERVICE</app> 
<ipAddr>127.0.0.1</ipAddr> 
<status>UP</status> 
<overriddenstatus>UNKNOWN</overriddenstatus> 
<port enabled="true">3001</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>1514334766260</registrationTimestamp> 
<lastRenewalTimestamp>1514334886300</lastRenewalTimestamp> 
<evictionTimestamp>0</evictionTimestamp> 
<serviceUpTimestamp>1514333831189</serviceUpTimestamp> 
</leaseInfo> 
<metadata class="java.util.Collections$EmptyMap"/> 
<vipAddress>steamauth.pubgtrade.com</vipAddress> 
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> 
<lastUpdatedTimestamp>1514334766260</lastUpdatedTimestamp> 
<lastDirtyTimestamp>1514334766260</lastDirtyTimestamp> 
<actionType>ADDED</actionType> 
</instance> 
</application> 
<application> 
<name>PUBG-API-GATEWAY</name> 
<instance> 
<instanceId>192.168.0.13:pubg-api-gateway:8079</instanceId> 
<hostName>192.168.0.13</hostName> 
<app>PUBG-API-GATEWAY</app> 
<ipAddr>192.168.0.13</ipAddr> 
<status>UP</status> 
<overriddenstatus>UNKNOWN</overriddenstatus> 
<port enabled="true">8079</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>1514334380413</registrationTimestamp> 
<lastRenewalTimestamp>1514334890454</lastRenewalTimestamp> 
<evictionTimestamp>0</evictionTimestamp> 
<serviceUpTimestamp>1514334380413</serviceUpTimestamp> 
</leaseInfo> 
<metadata> 
<management.port>8079</management.port> 
<jmx.port>36983</jmx.port> 
</metadata> 
<homePageUrl>http://192.168.0.13:8079/</homePageUrl> 
<statusPageUrl>http://192.168.0.13:8079/info</statusPageUrl> 
<healthCheckUrl>http://192.168.0.13:8079/health</healthCheckUrl> 
<vipAddress>pubg-api-gateway</vipAddress> 
<secureVipAddress>pubg-api-gateway</secureVipAddress> 
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> 
<lastUpdatedTimestamp>1514334380413</lastUpdatedTimestamp> 
<lastDirtyTimestamp>1514334380381</lastDirtyTimestamp> 
<actionType>ADDED</actionType> 
</instance> 
</application> 
</applications> 

すべてのヘルプは高く評価されます。ありがとう!

答えて

0

プロパティの代わりにapplication.ymlを使用し、これを私の中でセットアップする方法を教えてください。あなたはサービスに直接行くことができますか?つまりZUUL経由ではありません。

zuul: 
    routes: 
    path: /steam/** 
    service-id: steam-auth-service 
    strip-prefix: false 
eureka: 
    client: 
    serviceUrl: 
     defaultZone: http://localhost:8088/eureka 
関連する問題