저는 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>
이 어떤 도움에 감사드립니다 :
/유레카는/응답 애플 리케이션. 감사!