0

谁能指出我需要/工作配置以将 Elasticsearch 用作带有 Sleuth 的 Zipkins 的存储类型?

pom.xml

'

<description>Spring Boot Zipkin Server</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.7.RELEASE</version>
</parent>

<properties>
    <docker.image.prefix>springio</docker.image.prefix>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <sonar.skip>true</sonar.skip>
    <zipkin.version>1.6.0</zipkin.version>
    <elasticsearch.version>2.3.4</elasticsearch.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
    <!-- EXAMPLE FOR RABBIT BINDING -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.restdocs</groupId>
        <artifactId>spring-restdocs-mockmvc</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <finalName>demo-zipkin-server</finalName>
            </configuration>
        </plugin>
    </plugins>
</build>

`

应用程序.yml

server: port: 9411 spring: rabbitmq: host: ${RABBIT_HOST:localhost} eureka: client: register-with-eureka: true service-url: defaultZone: http://localhost:8761/eureka/ zipkin: self-tracing: enabled: false storage: type: elasticsearch elasticsearch: cluster: ${ES_CLUSTER:elasticsearch} hosts: ${ES_HOSTS:localhost:9300} index: ${ES_INDEX:zipkin} index-shards: ${ES_INDEX_SHARDS:5} index-replicas: ${ES_INDEX_REPLICAS:1}

应用程序不会以这些配置启动。引发原因:java.lang.NoSuchMethodError: org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper.inboundMappe

4

2 回答 2

3

您发布的类路径问题是特定于版本的。请更新到最新版本的依赖项。

例如,您可以从使用 start.spring.io 的基础项目开始,或者以其他方式获取最近的 deps。你也可以像这样复制一个项目:

https://github.com/openzipkin/sleuth-webmvc-example

Zipkin 目前对 elasticsearch 有原生支持(这意味着它不使用 Elasticsearch 驱动程序)。因此,自动配置它的依赖项是:

<!-- override sleuth's zipkin version since we are using latest -->
<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin</artifactId>
    <version>1.28.1</version>
</dependency>
<!-- add the dependency for elasticsearch via http -->
<dependency>
    <groupId>io.zipkin.java</groupId>
    <artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
    <version>1.28.1</version>
</dependency>

最少设置 zipkin.storage.type=elasticsearch。然后,设置您要覆盖注意弹性搜索的 http 端口是 9200 而不是 9300

最后,请为 zipkin 中的原生 RabbitMQ 支持投票,这样你就不需要做任何这些了!https://github.com/openzipkin/zipkin/issues/1614

于 2017-07-10T00:48:51.353 回答