spring - Eureka + Zuul + Spring Cloud Config Server + HTTPS 问题
问题描述
我正在使用微服务架构开发应用程序。我正在使用 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
问题:有没有人遇到过这种问题,有谁知道我该如何解决?
解决方案
推荐阅读
- python - numpy vstack vs 连接
- c++ - 如何创建只有位图的 wxMenu
- java - @Transactional 回滚 session.save() 异常
- node.js - 逐行读取一个巨大的日志文件并在节点中随机访问?
- r - R:查看我的随机样本中包含的观察结果
- ruby - 在 Apple Silicon (M1) 上安装 pod 时出错
- r - 有没有办法从 tbl_summary 中的单独表中提取标签?
- macos - SwiftUI 工作表崩溃,偶尔会出现关于修改状态的警告
- javascript - 无法遍历javascript中的对象数组。仅获得第一个元素的输出
- json - 如何递归搜索与给定模式匹配的所有节点的 JSON 文件并将 JSON“路径”返回到节点及其值?