Мой микро-сервис работает нормально.И при разработке он правильно регистрируется на сервере Eureka-Naming.Когда я развертываю свой сервис и eureka-сервер в двух разных контейнерах, мой микросервис не регистрируется на eureka-сервере.Все мои файлы конфигурации и свойств приведены ниже -
Eureka-Service dockerfile-
------------------------------------------------------------------
FROM openjdk:8u181-jdk-stretch
MAINTAINER Test "support@softwaredeveloper.com"
EXPOSE 8761
COPY maven/netflix-eureka-naming-server-0.0.1-SNAPSHOT.jar
netflix-eureka-naming-server.jar
CMD ["java","-jar","netflix-eureka-naming-server.jar"]
------------------------------------------------------------
customer-account-mysql dockerfile-
-------------------------------------------------------------
FROM openjdk:8u181-jdk-stretch
MAINTAINER Test "support@softwaredeveloper.com"
EXPOSE 8100
COPY maven/customer-account-mysql-0.0.1-SNAPSHOT.jar customer-
account-mysql.jar
CMD ["java","-jar","customer-account-mysql.jar"]
---------------------------------------------------------------
Compose File for customer-account-mysql and Eureka Server
--------------------------------------------------------------
customer-account-mysql:
image: customer-account-mysql
networks:
- customer-network
ports:
- 8100:8100
depends_on:
- netflix-eureka-naming-server
netflix-eureka-naming-server:
image: netflix-eureka-naming-server
networks:
- customer-network
ports:
- 8761:8761
-------------------------------------------------------
Properties file of customer-account-mysql
-----------------------------------------------------
spring.application.name=customer-account-mysql
server.port=8100
eureka.client.service-url.default-zone=http://netflix-eureka-
naming-server:8761/eureka/
------------------------------------------------------------
Properties file of eureka-server
---------------------------------------------------------
spring.application.name=netflix-eureka-naming-server
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.server.enableSelfPreservation=false
---------------------------------------------------------
But customer-account-mysql service is not registering in the
Eureka-Server. I have inspect the log on the customer-account-
mysql container.
Following error I was getting..
Error--------------
----------------------------------------------------------------
2019-02-06 06:27:33.248 ERROR [customer-account-mysql,,,] 1 ---
[nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient :
Request execution error. endpoint=DefaultEndpoint{
serviceUrl='http://localhost:8761/eureka/}
com.sun.jersey.api.client.ClientHandlerException:
java.net.ConnectException: Connection refused (Connection refused)
at com.sun.jersey.client.apache4.
ApacheHttpClient4Handler.handle(ApacheH
ttpClient4Handler.java:187) ~[jersey-apache-client4-
1.19.1.jar!/:1.19.1]
at
----------------------------------------------------------------
Моя учетная запись клиента-mysql пытается подключиться к http://localhost:8761/eureka/. Где я четко упоминаю зону по умолчанию в учетной записи клиента-файл свойств mysql.Это eureka.client.service-url.default-zone = http://netflix -eureka- сервер имен: 8761 / eureka /
Please help me to register my micro-service in the eureka
server.