找回密码
 立即注册
软件设计/软件工程 2022-05-04 235 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
问题
我的微服务运行良好。在开发过程中

在 Eureka 名称服务器上正确注册。当我部署我的

service和eureka server放在两个不同的容器里我的微服务没有在eureka server中注册。我所拥有的

配置和属性文件如下——
  1. Eureka-Service dockerfile-
  2. ------------------------------------------------------------------
  3. FROM openjdk:8u181-jdk-stretch
  4. MAINTAINER Test "support@softwaredeveloper.com"
  5. EXPOSE 8761
  6. COPY maven/netflix-eureka-naming-server-0.0.1-SNAPSHOT.jar
  7. netflix-eureka-naming-server.jar
  8. CMD ["java","-jar","netflix-eureka-naming-server.jar"]
  9. ------------------------------------------------------------

  10. customer-account-mysql dockerfile-
  11. -------------------------------------------------------------
  12. FROM openjdk:8u181-jdk-stretch
  13. MAINTAINER Test "support@softwaredeveloper.com"
  14. EXPOSE 8100
  15. COPY maven/customer-account-mysql-0.0.1-SNAPSHOT.jar customer-
  16. account-mysql.jar
  17. CMD ["java","-jar","customer-account-mysql.jar"]
  18. ---------------------------------------------------------------

  19. Compose File for customer-account-mysql and Eureka Server
  20. --------------------------------------------------------------
  21. customer-account-mysql:
  22.   image: customer-account-mysql
  23.   networks:
  24.      - customer-network
  25.   ports:
  26.      - 8100:8100
  27.   depends_on:
  28.      - netflix-eureka-naming-server
  29. netflix-eureka-naming-server:
  30.   image: netflix-eureka-naming-server
  31.   networks:
  32.      - customer-network
  33.   ports:
  34.      - 8761:8761
  35. -------------------------------------------------------

  36. Properties file of customer-account-mysql
  37. -----------------------------------------------------
  38. spring.application.name=customer-account-mysql
  39. server.port=8100
  40. eureka.client.service-url.default-zone=http://netflix-eureka-
  41. naming-server:8761/eureka/
  42. ------------------------------------------------------------

  43. Properties file of eureka-server
  44. ---------------------------------------------------------
  45. spring.application.name=netflix-eureka-naming-server
  46. server.port=8761
  47. eureka.client.register-with-eureka=false
  48. eureka.client.fetch-registry=false
  49. eureka.server.enableSelfPreservation=false

  50. ---------------------------------------------------------

  51. But customer-account-mysql service is not registering in the
  52. Eureka-Server. I have inspect the log on the customer-account-
  53. mysql container.
  54. Following error I was getting..
  55. Error--------------
  56. ----------------------------------------------------------------
  57. 2019-02-06 06:27:33.248 ERROR [customer-account-mysql,,,] 1 ---
  58. [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  :
  59. Request execution error. endpoint=DefaultEndpoint{
  60. serviceUrl='http://localhost:8761/eureka/}
  61. com.sun.jersey.api.client.ClientHandlerException:
  62. java.net.ConnectException: Connection refused (Connection refused)
  63. at com.sun.jersey.client.apache4.
  64. ApacheHttpClient4Handler.handle(ApacheH
  65. ttpClient4Handler.java:187) ~[jersey-apache-client4-
  66. 1.19.1.jar!/:1.19.1]
  67. at

  68. ----------------------------------------------------------------
复制代码

我的客户帐户 mysql 正在尝试连接

http://localhost:8761/eureka/。我清楚地提到了默认值

客户帐户 mysql 属性文件中的区域。那是

eureka.client.service url.default zone=http://netflix eureka-

名称服务器:8761/eureka/
  1. Please help me to register my micro-service in the eureka
  2. server.
复制代码

回答
我认为它应该是文档中所述的 eureka.client.serviceUrl.defaultZone ,而不是 eureka.client.service-url.default-zone 。您的应用程序未使用此属性,因此它回退到 localhost:8761 的默认值





上一篇:“拒绝访问” Excel 2019 桌面上的 Worksheet
下一篇:是否可以在 svg 矩形中设置负宽度?