标签:back str 项目配置 mys contain work 注解 enable span
一、方式一
1、拉镜像 docker pull openzipkin/zipkin 2、运行镜像 # 普通运行 docker run -d --restart always -p 9411:9411 --name zipkin openzipkin/zipkin
# docker-compose运行,新建docker-compose.yml加入以下内容
version: ‘2‘
services:
# The zipkin process services the UI, and also exposes a POST endpoint that
# instrumentation can send trace data to. Scribe is disabled by default.
zipkin:
image: openzipkin/zipkin
container_name: zipkin
environment:
- STORAGE_TYPE=mysql
# Point the zipkin at the storage backend
- MYSQL_DB=zipkin
- MYSQL_USER=root
- MYSQL_PASS=123456
- MYSQL_HOST=192.168.1.8
- MYSQL_TCP_PORT=3306
# Uncomment to enable scribe
# - SCRIBE_ENABLED=true
# Uncomment to enable self-tracing
# - SELF_TRACING_ENABLED=true
# Uncomment to enable debug logging
# - JAVA_OPTS=-Dlogging.level.zipkin=DEBUG -Dlogging.level.zipkin2=DEBUG
ports:
# Port used for the Zipkin UI and HTTP Api
- 9411:9411
# Uncomment if you set SCRIBE_ENABLED=true
# - 9410:9410
#networks:
# - default
# - my_net #创建网路 docker network create my_net 删除网络 docker network rm my_net
#networks:
#my_net:
#external: true
# 守护进程启动
cd 到docker-compose.yml目录下
docker-compose up -d
停止
docker-compose stop
3、访问 在浏览器访问:http://ip:9411/zipkin/
# 方式二
springcloud 官方按照传输方式分成了三种启动服务端的方式:Sleuth with Zipkin via HTTP,Sleuth with Zipkin via Spring Cloud Stream,Spring Cloud Sleuth Stream Zipkin Collector。只需要添加相应的依赖,之后配置相应的注解,如 @EnableZipkinStreamServer 即可。具体配置参考 Spring Cloud 官方文档
# 使用
# 依赖
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-zipkin</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> </dependency>
# 项目配置
spring:
zipkin:
#服务端地址
base-url: http://ip:9411
#本项目服务名
service:
name: ${spring.application.name}
sleuth:
#监控开关
enabled: true
#采样率
sampler:
percentage: 1
标签:back str 项目配置 mys contain work 注解 enable span
原文地址:https://www.cnblogs.com/jasonzeng/p/14713373.html