案例集成了Eureka、Zuul、OpenFeign、Zipkin、Hystrix等SpringCloud组件和基本使用方法。
- spring boot parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
- spring cloud
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
mvn package
java -jar eureka-server/target/eureka-server-2.1.0.jar
java -jar api-gateway/target/api-gateway-2.1.0.jar
java -jar open-feign/target/open-feign-2.1.0.jar
java -jar service-A/target/service-A-2.1.0.jar
http://localhost:5555/api-a?a=1&b=2
http://localhost:2300/?a=1&b=2
Zipkin链路追踪
curl -sSL https://zipkin.io/quickstart.sh | bash -s
java -jar zipkin.jar
配置 http://127.0.0.1:5555/hystrix.stream
- 1.服务注册和发现
- 2.api-gateway 认证,负载,熔断。具体参考 项目中的配置文件
- 3.service 服务,基本的运算