Докер Эврика Неизвестно
Я пытаюсь создать микросервисную архитектуру с помощью приложений, загружаемых через Springboot.
Для внутренних коммуникаций я хочу использовать Eureka + FeignClient. Регистрация в Eureka работает отлично (afaik):
<application>
<name>CAREER-SERVICE</name>
<instance>
<instanceId>4b62546fdc9b:career-service:7000</instanceId>
<hostName>172.18.0.15</hostName>
<app>CAREER-SERVICE</app>
<ipAddr>172.18.0.15</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">7000</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>1497345551521</registrationTimestamp>
<lastRenewalTimestamp>1497347501260</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1497345550971</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://172.18.0.15:7000/</homePageUrl>
<statusPageUrl>http://172.18.0.15:7000/info</statusPageUrl>
<healthCheckUrl>http://172.18.0.15:7000/health</healthCheckUrl>
<vipAddress>career-service</vipAddress>
<secureVipAddress>career-service</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1497345551521</lastUpdatedTimestamp>
<lastDirtyTimestamp>1497345550555</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
<application>
<name>AUTH-SERVICE</name>
<instance>
<instanceId>5ecc30b0fcd1:auth-service:5000</instanceId>
<hostName>172.18.0.11</hostName>
<app>AUTH-SERVICE</app>
<ipAddr>172.18.0.11</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">5000</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>1497345537851</registrationTimestamp>
<lastRenewalTimestamp>1497347517943</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1497345536974</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://172.18.0.11:5000/</homePageUrl>
<statusPageUrl>http://172.18.0.11:5000/info</statusPageUrl>
<healthCheckUrl>http://172.18.0.11:5000/health</healthCheckUrl>
<vipAddress>auth-service</vipAddress>
<secureVipAddress>auth-service</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1497345537851</lastUpdatedTimestamp>
<lastDirtyTimestamp>1497345506847</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
В одном из моих сервисов мне нужно получить доступ к сервису аутентификации и попытаться сделать это с помощью интерфейса AuthServiceClient и @FeignClient Аннотация:
FeignClient(name = "auth-service")
public interface AuthServiceClient {
@RequestMapping(method = RequestMethod.POST, value = "/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
void createUser(User user);
}
Когда я вызываю этот метод, я получаю следующее исключение:
account_1 | 2017-06-13 09:55:35.654 ERROR 1 --- [nio-6000-exec-6] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/accounts] threw exception [Request processing failed; nested exception is com.netflix.hystrix.exception.HystrixRuntimeException: createUser failed and no fallback available.] with root cause
account_1 |
account_1 | java.net.UnknownHostException: auth-service
Зарегистрированные IP-адреса верны. Мне просто интересно, почему он не знает "auth-service". Так что, наверное, он даже не пытается поговорить с Эврикой? Как я могу отлаживать таким образом?