1. 部署运行Zipkin
[root@dev ~]# yum -y install java-1.8.0-openjdk*
[root@dev ~]# vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64 #(具体看你自己安装的版本)
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
[root@dev ~]# wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec'
[root@dev ~]# nohup java -jar zipkin.jar &
2. 配置Zipkin监控
2.1 配置被监控应用的 application.yml
spring:
zipkin:
enabled: true
baseUrl: http://10.1.43.147:9411
sleuth:
sampler:
percentage: 1
2.1 配置被监控应用的 pom.xml
<dependencies>
<!-- spring boot -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
3. 启动被监控应用,查看监控结果
http://IP:9411/zipkin/
网友评论