80. Running Spring Cloud Services in Development
Launcher CLI 可用于从命令 line 中运行 Eureka,Config Server 等 common common 服务。列出可用的服务spring cloud --list
,并启动一组默认服务spring cloud
。要选择要部署的服务,只需在命令 line,e.g 上列出它们。
$ spring cloud eureka configserver h2 kafka stubrunner zipkin
支持的可部署的摘要:
服务 | 名称 | 地址 | 描述 |
---|---|---|---|
eureka | Eureka Server | http://localhost:8761 | Eureka 服务器用于服务注册和发现。默认情况下,所有其他服务都显示在其目录中。 |
configserver | 配置服务器 | http://localhost:8888 | Spring Cloud Config Server running in“native”profile 并从本地目录./launcher 提供 configuration |
H2 | H2 数据库 | http://localhost:9095( console),jdbc:h2:tcp://localhost:9096/ {。 11} | 关系数据库服务。连接时使用{data} (e.g. ./target/test )的文件路径。请记住,您可以添加;MODE=MYSQL 或;MODE=POSTGRESQL 以连接与其他服务器类型的兼容性。 |
kafka | Kafka Broker | http://localhost:9091( actuator endpoints),localhost:9092 | |
hystrixdashboard | Hystrix 仪表板 | http://localhost:7979 | 声明 Hystrix 断路器的任何 Spring Cloud 应用程序在/hystrix.stream 上发布 metrics。在仪表板中键入该地址以显示所有 metrics, |
数据流 | 数据流服务器 | http://localhost:9393 | Spring Cloud 数据流服务器,UI 位于/admin-ui。将 Dataflow shell 连接到根路径的目标。 |
zipkin | Zipkin 服务器 | http://localhost:9411 | Zipkin Server 带有用于可视化跟踪的 UI。 在 memory 中存储 span 数据并通过 HTTP POST 的 JSON 数据接受它们。 |
stubrunner | Stub Runner Boot | http://localhost:8750 | 下载 WireMock 存根,启动 WireMock 并使用存储的存根提供已启动的服务器。传递stubrunner.ids 以传递存根坐标,然后转到http://localhost:8750/stubs 。 |
可以使用具有相同 name 的本地 YAML 文件(在当前工作目录或名为“config”或~/.spring-cloud
的子目录中)配置这些应用程序中的每一个。 E.g。在configserver.yml
中你可能想要做这样的事情来为后端找到一个本地 git repository:
configserver.yml.
spring:
profiles:
active: git
cloud:
config:
server:
git:
uri: file://${user.home}/dev/demo/config-repo
E.g。在 Stub Runner 应用程序中,您可以通过以下方式从本地.m2
获取存根。
stubrunner.yml.
stubrunner:
workOffline: true
ids:
- com.example:beer-api-producer:+:9876
80.1 添加其他 Applications
可以将其他 applications 添加到./config/cloud.yml
(不是./config.yml
因为它将替换默认值),e.g. 同
config/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 cloud --list
source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin
(注意列表开头的其他应用程序)。