dubbo 整合 zipkin,最简单的方式,亲测有效
生活随笔
收集整理的這篇文章主要介紹了
dubbo 整合 zipkin,最简单的方式,亲测有效
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
大家好,我是烤鴨。
? ? 之前也試過網上很多版本,看了好多文章。現在分享最簡單的方式,代碼侵入性最小的。
?
1. 修改pom,引入jar。
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --> <dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.0.9.RELEASE</version> </dependency> <!--zikpin--> <!-- https://mvnrepository.com/artifact/io.zipkin.brave/brave-instrumentation-dubbo-rpc --> <dependency><groupId>io.zipkin.brave</groupId><artifactId>brave-instrumentation-dubbo-rpc</artifactId><version>5.6.8</version> </dependency> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zipkin</artifactId> </dependency> <!--zikpin end -->?
2. 下載 zipkin.jar 并啟動
wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec' nohup java -jar zipkin-server-2.12.9-exec.jar啟動成功后訪問如圖:
?
3. 修改 yml 配置文件
?增加 zipkin相關配置,provider 和 consumer 都需要添加
spring:servlet:multipart:max-file-size: 20MBmax-request-size: 20MBenabled: truezipkin:enabled: truebase-url: http://xx.xx.xx.69:9411 #zipkin地址sender:type: web #向http發送trace信息?provider:
? ? ? ?增加 provider.filter: 'tracing'
dubbo:application:id: etc_manage_servicename: etc_manage_serviceprotocol:port: 20883threadpool: cachedthreads: 500accepts: 1000dispatcher: messageprovider:timeout: 600000filter: 'tracing'registry:address: zookeeper://127.0.0.1:2181scan:basePackages: xxx.xxxconsumer:
? ? ? ?增加 consumer.filter: 'tracing'
dubbo:application:id: etc_manage_webname: etc_manage_webregistry:address: zookeeper://127.0.0.1:2181scan:base-packages: xxx.xxxconsumer:filter: 'tracing'4. 啟動服務后,調用如圖:
? ??
總結:
最開始的時候,也有時候會有調用服務,但是zipkin 沒有收到請求的情況,發現是 zipkin 沒有生效,可能是引入的zipkin的包太多了,刪除不用的。
?還有zipkin的配置:
?zipkin.base-url:xx
?這個地方是 base-url,不是baseUrl。
?還有就是 consumer 有記錄,但是 provider沒有。
?配置了 provider.filter 之后,又重啟了服務,之后試了幾次,就可以了。
總結
以上是生活随笔為你收集整理的dubbo 整合 zipkin,最简单的方式,亲测有效的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: juce中的BailOutChecker
- 下一篇: Nicescroll用法