繁体   English   中英

Eureka + Zuul + Spring Cloud Config Server + HTTPS 问题

[英]Eureka + Zuul + Spring Cloud Config Server + HTTPS problem

我正在使用微服务架构开发应用程序。 我正在使用 Spring Cloud Eureka 和 Spring Cloud Zuul。 我也在使用 Cloud Config Server,因为我想将路由动态添加到 Zuul 网关。 我在使用 Cloud Config Server 时遇到问题。 它已在 Eureka Server 中注册(我在 Eureka Dashboard 中看到了它的一个实例),但是例如,当我运行 Zuul Gateway 时,出现异常

“java.lang.IllegalStateException:未找到配置服务器(云配置服务器)的实例”

然后微服务关闭。 问题开始于HTTPS协议的实施。 在此之前,微服务和配置服务器的相同配置运行良好。

在此处输入图片说明

这是 Eureka application.yml 文件:

eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
  server:
    waitTimeInMsWhenSyncEmpty: 0
  instance:
    hostname: localhost
    securePort: ${server.port}
    securePortEnabled: true  
    nonSecurePortEnabled: false 
    homePageUrl: https://${eureka.instance.hostname}:${server.port}/
    statusPageUrl: https://${eureka.instance.hostname}:${server.port}/admin/info
server:
  port: 8761
  ssl:
    enabled: true
    key-alias: service-registry
    key-store: classpath:service-registry.jks
    key-store-password: password
    key-store-type: JKS
    trust-store: classpath:service-registry.jks
    trust-store-password: password
    trust-store-type: JKS

这是 Zuul application.yml 文件:

server:
  port: 8762
  ssl:
    enabled: true
    key-store: classpath:zuul-gateway.jks
    key-store-password: password
    key-alias: zuul-gateway
eureka:
  instance:
    hostname: localhost
    nonSecurePortEnabled: false
    securePortEnabled: true
    securePort: ${server.port}
    statusPageUrl: https://localhost:${server.port}/info
    healthCheckUrl: https://localhost:${server.port}/health
    homePageUrl: https://localhost:${server.port}
  client:
    serviceUrl:
      defaultZone:  ${EUREKA_URI:https://localhost:8761/eureka}
    fetch-registry: true
    register-with-eureka: true
zuul:
  prefix: /api
  routes:
    mock-bitcoin-service:
      service-id: mock-bitcoin-service
      path: /mock-bitcoin-service/**
  host:
    connect-timeout-millis: 5000000
    socket-timeout-millis: 5000000
  ignoredServices: '*'

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 12000
ribbon:
  ConnectTimeout: 10000
  ReadTimeout: 10000

这是 Spring Cloud Config Server application.yml 文件:

server:
  port: 8888
  ssl:
    enabled: true
    key-store: classpath:cloud-config-server.jks
    key-store-password: password
    key-alias: cloud-config-server
    key-store-type: JKS
    trust-store: classpath:cloud-config-server.jks
    trust-store-password: password
    trust-store-type: JKS
eureka:
  instance:
    nonSecurePortEnabled: false
    securePortEnabled: true
    securePort: ${server.port}
    statusPageUrl: https://localhost:${server.port}/info
    healthCheckUrl: https://localhost:${server.port}/health
    homePageUrl: https://localhost:${server.port}
    lease-expiration-duration-in-seconds: 20
    lease-renewal-interval-in-seconds: 10
  client:
    enabled: true
    instance-info-replication-interval-seconds: 10
    registry-fetch-interval-seconds: 10
    serviceUrl:
      defaultZone:  ${EUREKA_URI:https://localhost:8761/eureka}
    fetch-registry: true
    register-with-eureka: true
spring:
  cloud:
    config:
      server:
        git:
          clone-on-start: true
          search-paths: /config/{application}
          uri: https://github.com/XXXX.git

问题:以前有没有人遇到过这种问题,有谁知道我该如何解决?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM