zoukankan      html  css  js  c++  java
  • SpringCloud Sleuth分布式请求链路追踪

    问题:

     是什么?

    zipkin:

     

    搭建链路监控的步骤:

    服务提供者8001和服务消费者80的搭建

    pom:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>cloud2020</artifactId>
            <groupId>com.atguigu.springcloud</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>cloud-provider-payment8001</artifactId>
    
        <dependencies>
            <!--包含了sleuth+zipkin-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-zipkin</artifactId>
            </dependency>
            <!--eureka-client-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
            </dependency>
            <!--引入自己定义的api通用包,可以使用Payment支付Entity-->
            <dependency>
                <groupId>com.atguigu.springcloud</groupId>
                <artifactId>cloud-api-commons</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>1.1.10</version>
            </dependency>
            <!--mysql-connector-java-->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </project>

    YML;

    server:
      port: 8001
    
    spring:
      application:
        name: cloud-provider-service
    
      datasource:
        type: com.alibaba.druid.pool.DruidDataSource      #当前数据源操作类型
        driver-class-name: org.gjt.mm.mysql.Driver        #mysql驱动包
        url: jdbc:mysql://localhost:3306/db2019?useUnicode=true&characterEncoding-utr-8&useSSL=false
        username: root
        password: root
    zipkin: base
    -url: http://localhost:9411 sleuth: sampler: probability: 1 #采样率值介于θ到1之间,1则表示全部来集 eureka: client: #表示是否将自己注册进EurekaServer默认为true register-with-eureka: true #是否从EurekaServer抓取已有的注册信息,默认为true。单节点无所谓,集群必须设置为true才能配合ribbon使用负载均衡 fetch-registry: true service-url: defaultZone: http://localhost:7001/eureka #单机版 #defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka #集群版 instance: instance-id: payment8001 prefer-ip-address: true #访问路径可以显示IP地址 #Eureka客户端向服务端发送心跳的时间间隔,单位为秒(默认是30秒) #lease-renewal-interval-in-seconds: 1 #Eurekaf服务端在收到最后一次心跳后等待时间上限,单位为秒(默认是90秒),超时将剔除服务 #lease-expiration-duration-in-seconds: 2 mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: com.atguigu.springcloud.entities #所有Entity别名类所在包

     结果:

  • 相关阅读:
    From MSI to WiX, Part 2
    From MSI to WiX, Part 1
    WIX Custom Action (immediate, deffered, rollback)
    SVN: revert all command
    HowTo: SVN undo add without reverting local changes
    “Assign Random Colors” is not working in 3ds Max 2015
    CruiseControl.NET : svnrevisionlabeller
    JSON parser error with double quotes
    How to: Extract files from a compiled setup.exe created by Inno setup
    虚拟账号ftp服务器
  • 原文地址:https://www.cnblogs.com/leeego-123/p/12695984.html
Copyright © 2011-2022 走看看