bur*_*lug 5 mysql zipkin spring-boot spring-cloud
application.yml
Spring Boot/Cloud Zipkin服务器(可能是Zipkin Stream服务器)需要哪些确切的依赖关系和配置才能使用MySQL持久化跟踪数据?
官方文档很有帮助,但我认为它没有明确包含所有依赖项(至少截至目前).我不得不对样本做一些额外的研究,以获得所有必需的依赖关系和配置.我想分享它,因为我相信它对其他人有帮助.
Spring Boot版本: 1.4.0.RELEASE
Spring Cloud版本: Brixton.SR4
POM:
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)
Java的:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin.server.EnableZipkinServer;
@SpringBootApplication
@EnableZipkinServer
public class ZipkinServerApplication {
public static void main(String[] args) {
SpringApplication.run(ZipkinServerApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
application.yml:
spring:
datasource:
schema: classpath:/mysql.sql
url: jdbc:mysql://localhost:3306/zipkin?autoReconnect=true
username: root
password: admin
driver-class-name: com.mysql.jdbc.Driver
initialize: true
continue-on-error: true
sleuth:
enabled: false
zipkin:
storage:
type: mysql
Run Code Online (Sandbox Code Playgroud)
参考文献:
https://cloud.spring.io/spring-cloud-sleuth/
归档时间: |
|
查看次数: |
5575 次 |
最近记录: |