项目环境:
win7、jdk8
1、添加依赖,添加了spring-cloud-starter-zipkin会自动导入Sleuth
<!--Sleuth,zipkin-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<!--end Sleuth,zipkin-->
项目的Spring Cloud的版本如下:
<dependencyManagement>
<dependencies>
<!--整合spring cloud-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--整合spring cloud alibaba-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
2、添加配置
spring:
zipkin:
base-url: http://localhost:9411/
discoveryClientEnabled: false
sleuth:
sampler:
# 抽样率,默认是0.1(10%)
probability: 1.0
3、下载Zipkin Server
方式1:使用Zipkin官方的Shell下载
curl -sSL https://zipkin.io/quickstart.sh | bash -s
下载下来的文件名为 zipin.jar
方式2:到Maven中央仓库下载
下载地址如下:
https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec
下载下来的文件名为 zipkin-server-2.12.9-exec.jar
4、启动Zipkin Server
java -jar zipkin-server-2.12.9-exec.jar
出现以下界面启动成功: