https://github.com/zq2599/blog_demos
内容:所有原创文章分类汇总及配套源码,涉及Java、Docker、Kubernetes、DevOPS等;
00:18:12 [http-nio-8080-exec-1] INFO c.b.j.p.c.HelloController [traceId=49476da841cd354b spanId=b595271a496cb0cb sampled=true] start hello from [1632269892342] 00:18:12 [http-nio-8080-exec-1] INFO c.b.j.p.c.HelloController [traceId=49476da841cd354b spanId=b595271a496cb0cb sampled=true] hello 00:18:12 [http-nio-8080-exec-1] INFO i.j.i.r.LoggingReporter [traceId=49476da841cd354b spanId=b595271a496cb0cb sampled=true] Span reported: 49476da841cd354b:991b82965543f8da:e6333b3a1c14f544:1 - mockBizChild 00:18:12 [http-nio-8080-exec-1] INFO i.j.i.r.LoggingReporter [traceId=49476da841cd354b spanId=b595271a496cb0cb sampled=true] Span reported: 49476da841cd354b:e6333b3a1c14f544:b595271a496cb0cb:1 - mockBiz 00:18:13 [http-nio-8080-exec-1] INFO i.j.i.r.LoggingReporter [traceId=49476da841cd354b spanId=b595271a496cb0cb sampled=true] Span reported: 49476da841cd354b:45e256ba3deed679:b595271a496cb0cb:1 - SET 00:18:13 [http-nio-8080-exec-1] INFO i.j.i.r.LoggingReporter [traceId= spanId= sampled=] Span reported: 49476da841cd354b:b595271a496cb0cb:6322077c0edb62cc:1 - hello
00:12:42 [http-nio-8080-exec-10] INFO c.b.j.p.c.HelloController [traceId=6430f498d5623103 spanId=9e4a4c8bb326352b sampled=true] start hello from [1632269562868] 00:12:42 [http-nio-8080-exec-10] INFO c.b.j.p.c.HelloController [traceId=6430f498d5623103 spanId=9e4a4c8bb326352b sampled=true] hello
docker run -d \ --name jaeger \ -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \ -p 5775:5775/udp \ -p 6831:6831/udp \ -p 6832:6832/udp \ -p 5778:5778 \ -p 16686:16686 \ -p 14268:14268 \ -p 14269:14269 \ -p 9411:9411 jaegertracing/all-in-one:1.26
docker run -d \ --name jaeger \ -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \ -e SPAN_STORAGE_TYPE=badger \ -e BADGER_EPHEMERAL=false \ -e BADGER_DIRECTORY_VALUE=/badger/data \ -e BADGER_DIRECTORY_KEY=/badger/key \ -v /Users/will/temp/202109/28/data:/badger \ -p 5775:5775/udp \ -p 6831:6831/udp \ -p 6832:6832/udp \ -p 5778:5778 \ -p 16686:16686 \ -p 14268:14268 \ -p 14269:14269 \ -p 9411:9411 jaegertracing/all-in-one:1.26
此时再重启或者重建Jaeger容器,历史数据都会完整保存
如果您是在docker-compose.yml中配置all-in-one镜像,那么要注意yml文件中无法输入布尔型属性值,需要参考以下方式处理:
首先在docker-compose.yml所在目录创建文件.env,内容如下:
BADGER_FLAG=true
version: '3.0' networks: jaeger-tutorials-net: driver: bridge ipam: config: - subnet: 192.168.1.0/24 gateway: 192.168.1.1 volumes: # 用于存储badger的数据 badger-data: services: jaeger: image: jaegertracing/all-in-one:1.26 container_name: jaeger # 处理时钟漂移带来的计算出负数的问题 command: ["--query.max-clock-skew-adjustment=100ms"] # 选择网络 networks: - jaeger-tutorials-net # 持久化,请选择适合自己的目录 environment: SPAN_STORAGE_TYPE: badger BADGER_EPHEMERAL: ${BADGER_FLAG} BADGER_DIRECTORY_VALUE: /badger/data BADGER_DIRECTORY_KEY: /badger/key # badger存储在本地卷(或者映射到本地某个目录) volumes: - badger-data:/badger #选择端口 ports: - 16686:16686/tcp restart: always
我是欣宸,期待与您一同畅游Java世界…
https://github.com/zq2599/blog_demos