###zipkin服务器端 1、依赖
<!-- zipkin server -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<!-- kafka -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-collector-kafka</artifactId>
<version>2.4.1</version>
</dependency>
2、启动类上添加@EnableZipkinServer 3、配置文件
#存储类型,缺失配置项的时候默认使用内存
zipkin.storage.type=mem
zipkin.collector.kafka.bootstrap-servers=10.1.8.2:9192
zipkin.collector.kafka.zookeeper=10.1.8.2:2282/kafka210dev
#kafka主题,不配置时默认使用zipkin
zipkin.collector.kafka.topic=zipkin
###微服务端 1、依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
2、配置
#配置zipkin发送类型为kafka
spring.zipkin.sender.type=kafka
spring.kafka.bootstrap-servers=10.1.8.2:9192
#kafka主题,不配置时默认使用zipkin
spring.zipkin.kafka.topic=zipkin
#设置服务名,不设置默认使用spring.application.name
spring.zipkin.service.name=gateway
#采样率设置
spring.sleuth.sampler.percentage=1.0
###创建Kafka主题 进入kafka的bin目录,创建zipkin主题。
kafka-topics.sh --create --zookeeper 10.1.8.2:2282/kafka210dev --replication-factor 1 --partitions 1 --topic zipkin
监视kafka中的数据
kafka-console-consumer.sh --bootstrap-server 10.1.8.2:9192 --topic zipkin
参考周立大神博文:http://www.itmuch.com/spring-cloud/edgware-new-sleuth-zipkin-mq/