在开发中运行 Spring Cloud Services

Launcher CLI 可用于运行常见服务,例如 Eureka、 Config Server 等。要列出可用的 您可以提供的服务spring cloud --list,并启动默认集 服务spring cloud.要选择要部署的服务, 只需在命令行上列出它们,例如spring-doc.cadn.net.cn

$ spring cloud eureka configserver h2 kafka stubrunner zipkin

支持的可部署对象摘要:spring-doc.cadn.net.cn

服务 名称 地址 描述

尤里卡spring-doc.cadn.net.cn

尤里卡服务器spring-doc.cadn.net.cn

http://localhost:8761spring-doc.cadn.net.cn

用于服务注册和发现的 Eureka 服务器。默认情况下,所有其他服务都显示在其目录中。spring-doc.cadn.net.cn

配置服务器spring-doc.cadn.net.cn

配置服务器spring-doc.cadn.net.cn

http://localhost:8888spring-doc.cadn.net.cn

Spring Cloud Config Server 在“本机”配置文件中运行,并从本地目录 ./launcher 提供配置spring-doc.cadn.net.cn

h2spring-doc.cadn.net.cn

H2数据库spring-doc.cadn.net.cn

http://localhost:9095(控制台),jdbc:h2:tcp://localhost:9096/{data}spring-doc.cadn.net.cn

关系数据库服务。将文件路径用于{data}(例如./target/test) 连接时。请记住,您可以添加;MODE=MYSQL;MODE=POSTGRESQL以兼容其他服务器类型进行连接。spring-doc.cadn.net.cn

卡 夫 卡spring-doc.cadn.net.cn

卡夫卡经纪人spring-doc.cadn.net.cn

http://localhost:9091(执行器端点),localhost:9092spring-doc.cadn.net.cn

hystrix仪表板spring-doc.cadn.net.cn

Hystrix 仪表板spring-doc.cadn.net.cn

http://localhost:7979spring-doc.cadn.net.cn

任何声明 Hystrix 断路器的 Spring Cloud 应用程序都会在/hystrix.stream.在仪表板中键入该地址以可视化所有指标,spring-doc.cadn.net.cn

数据流spring-doc.cadn.net.cn

数据流服务器spring-doc.cadn.net.cn

http://localhost:9393spring-doc.cadn.net.cn

Spring Cloud Dataflow 服务器,UI 位于 /admin-ui。将数据流外壳连接到根路径的目标。spring-doc.cadn.net.cn

齐普金spring-doc.cadn.net.cn

Zipkin 服务器spring-doc.cadn.net.cn

http://localhost:9411spring-doc.cadn.net.cn

带有用于可视化跟踪的 UI 的 Zipkin 服务器。将跨度数据存储在内存中,并通过 JSON 数据的 HTTP POST 接受它们。spring-doc.cadn.net.cn

存根行者spring-doc.cadn.net.cn

短管滑道靴spring-doc.cadn.net.cn

http://localhost:8750spring-doc.cadn.net.cn

下载 WireMock 存根,启动 WireMock 并将存储的存根提供给已启动的服务器。通过stubrunner.ids传递存根坐标,然后转到http://localhost:8750/stubs.spring-doc.cadn.net.cn

可以使用具有相同名称的本地 YAML 文件配置其中每个应用程序(在当前 工作目录或名为“config”的子目录或~/.spring-cloud).例如在configserver.yml你可能想要 执行以下作以查找后端的本地 Git 存储库:spring-doc.cadn.net.cn

configserver.yml
spring:
  profiles:
    active: git
  cloud:
    config:
      server:
        git:
          uri: file://${user.home}/dev/demo/config-repo

例如,在 Stub Runner 应用程序中,您可以从本地获取存根.m2以以下方式。spring-doc.cadn.net.cn

stubrunner.yml
stubrunner:
  workOffline: true
  ids:
    - com.example:beer-api-producer:+:9876

添加其他应用程序

可以将其他应用程序添加到./config/cloud.yml(不是./config.yml因为这会替换默认值),例如spring-doc.cadn.net.cn

配置/cloud.yml
spring:
  cloud:
    launcher:
      deployables:
        source:
          coordinates: maven://com.example:source:0.0.1-SNAPSHOT
          port: 7000
        sink:
          coordinates: maven://com.example:sink:0.0.1-SNAPSHOT
          port: 7001

列出应用时:spring-doc.cadn.net.cn

$ spring cloud --list
source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin

(请注意列表开头的其他应用程序)。spring-doc.cadn.net.cn