使用spring-cloud-sleuth-zipkin追踪服务链

ゝ一世哀愁。 2022-05-25 01:12 296阅读 0赞

一、zipkin服务器配置

新建一个Springboot工程,POM文件主要内容:

1、Springcloud信息

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>1.5.10.RELEASE</version>
  5. </parent>
  6. <dependencyManagement>
  7. <dependencies>
  8. <dependency>
  9. <groupId>org.springframework.cloud</groupId>
  10. <artifactId>spring-cloud-dependencies</artifactId>
  11. <version>Edgware.SR3</version>
  12. <type>pom</type>
  13. <scope>import</scope>
  14. </dependency>
  15. </dependencies>
  16. </dependencyManagement>

2、zipkin服务器信息

  1. <dependencies>
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter</artifactId>
  5. </dependency>
  6. <dependency>
  7. <groupId>org.springframework.boot</groupId>
  8. <artifactId>spring-boot-starter-test</artifactId>
  9. <scope>test</scope>
  10. </dependency>
  11. <dependency>
  12. <groupId>io.zipkin.java</groupId>
  13. <artifactId>zipkin-server</artifactId>
  14. </dependency>
  15. <dependency>
  16. <groupId>io.zipkin.java</groupId>
  17. <artifactId>zipkin-autoconfigure-ui</artifactId>
  18. </dependency>
  19. </dependencies>

3、Application主类信息

添加注解@EnableZipkinServer

4、application.yml配置文件信息

  1. spring:
  2. application:
  3. name: zipkin-server
  4. server:
  5. port: 9411

5、部署

  1. 192.168.1.203:9411

6、访问

  1. http://192.168.1.203:9411

二、zipkin客户端配置

1、pom文件添加zipkin支持

  1. <dependency>
  2. <groupId>org.springframework.cloud</groupId>
  3. <artifactId>spring-cloud-sleuth-zipkin</artifactId>
  4. </dependency>

2、application.yml配置文件信息

  1. spring:
  2. zipkin:
  3. base-url: http://192.168.1.203:9411

发表评论

表情:
评论列表 (有 0 条评论,296人围观)

还没有评论,来说两句吧...

相关阅读

    相关 服务追踪

    服务链路追踪 为什么需要服务追踪 在微服务架构下,由于进行了服务拆分,一次请求往往需要涉及多个服务, 每个服务可能是由不同的团队开发,使用了不同的编程语言,还有

    相关 SpringCloud 服务追踪Sleuth

    微服务架构是通过业务来划分服务的,对外暴露的接口,可能需要很多个服务协同才能完成一个接口功能,如果链路上任何一个服务出现问题,都会形成导致接口调用失败。此时查找出现问题的微服务