zoukankan      html  css  js  c++  java
  • Spring Cloud Sleuth 服务跟踪

    项目结构:

    一跟踪服务中心,用于收集和展示跟踪情况。

    一个服务提供者。

    一个服务消费者。

    服务跟踪中心:

    pom.xml添加如下依赖:

    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-autoconfigure-ui</artifactId>
    </dependency>
    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-server</artifactId>
    </dependency>
    

    配置:简单的一个端口就可以。

    server:
      port: 9411
    

    启动类头部加入注解:

    @EnableZipkinServer
    

    启动后如下:localhost:9411

    服务提供者:

    pom.xml

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-zipkin</artifactId>
    </dependency>
    

      

    配置:

    跟踪服务中心地址:http://localhost:9411

    检测率(100%检测):sleuth:sampler percentage: 1.0 

    spring:
      application:
        name: thunisoft-microservice-testconsumer-sleuth
      zipkin:
        base-url: http://localhost:9411
      sleuth:
        sampler:
          percentage: 1.0
    server:
      port: 49544
    eureka:
      instance:
        hostname: localhost
        lease-renewal-interval-in-seconds: 1
        lease-expiration-duration-in-seconds: 2
      client:
        service-url:
          defaultZone: http://localhost:8000/eureka
    

      

    服务消费者:

    同上。

  • 相关阅读:
    25-javaweb接入支付宝支付接口
    4-js 函数
    24-filter-拦截器
    23-新建maven 项目
    22-maven-安装与配置
    15-matlab矩阵运用
    2018.7.18 div,section,article的区别和使用
    2018.7.17 牛客网训练
    2018.7.16常用推荐算法
    2018.7.15 解决css中input输入框点击时去掉外边框方法
  • 原文地址:https://www.cnblogs.com/hfultrastrong/p/8691258.html
Copyright © 2011-2022 走看看