2016-08-26 13 views
4

Spring Boot/Cloud Zipkinサーバー(潜在的にZipkin Streamサーバー)でMySQLを使用してトレースデータを永続化するには、正確な依存関係とapplication.yml構成が必要ですか?永続性のためにSpring Cloud Zipkin ServerをMySQLで設定するには?

+0

あなたは質問をし、分以内に答えます? –

+2

stackoverflowにはq/aスタイルのような質問を回答するオプションもあります。私はこれを手に入れようとしている私のような人にとっては役に立つと思っていたので、ここに投稿しました。 http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/ – burcakulug

+0

よろしくお願いします。私は、そのオプションの形式が異なることを期待していました。面白い。新しい何か新しい毎日の笑を学ぶ。 –

答えて

5

公式のドキュメントは役に立ちましたが、(少なくとも現在のところは)明示的にすべての依存関係を明示していなかったと思います。必要な依存関係と構成をまとめてサンプルを得るために余分な研究をする必要がありました。私はそれが他の人にとって有益かもしれないと信じているので、私はそれを共有したいと思っていました。

春ブートバージョン:1.4.0.RELEASE

春クラウド版: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> 

の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); 
    } 
} 

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 

参考文献:

https://cloud.spring.io/spring-cloud-sleuth/

+0

あなたは、この問題(https://github.com/spring-cloud/spring-cloud-sleuth/issues/255)にあなたの発言を掲載することができます。私たちはさまざまなストレージからすべての知識を収集しようとしています –

+0

作業コードのレポはここにありますhttps://github.com/nitinware/Trace-Sleuth-ZipKin – jaks

関連する問題