zipkin配置

原创
2017/03/31 17:49
阅读数 614

介绍

        zipkin的默认storage采用的是mem,这在生产环境显然不行的,不过这些组件都可可以更换的,storage还支持mysql和elasticsearch,transport支持http和kafka,个人觉得kafka配elasticsearch会更好维护一些。

        但是,官网的启动就是 java -jar xxx.jar直接启动了,再者官方文档真是简洁明了,没有任何配置的信息,还好被我找到了,解压启动的jar文件,配置文件是BOOT-INF/classes/zipkin-server-shared.yml

配置

        zipkin-server-shared.yml

zipkin:
  self-tracing:
    enabled: ${SELF_TRACING_ENABLED:false}
    sample-rate: ${SELF_TRACING_SAMPLE_RATE:1.0}
    flush-interval: ${SELF_TRACING_FLUSH_INTERVAL:1}
  collector:
    sample-rate: ${COLLECTOR_SAMPLE_RATE:1.0}
    kafka:
      zookeeper: ${KAFKA_ZOOKEEPER:}
      topic: ${KAFKA_TOPIC:zipkin}
      group-id: ${KAFKA_GROUP_ID:zipkin}
      streams: ${KAFKA_STREAMS:1}
      max-message-size: ${KAFKA_MAX_MESSAGE_SIZE:1048576}
    scribe:
      enabled: ${SCRIBE_ENABLED:true}
      category: zipkin
      port: ${COLLECTOR_PORT:9410}
  query:
    lookback: ${QUERY_LOOKBACK:86400000}
    names-max-age: 300
    allowed-origins: "*"

  storage:
    strict-trace-id: ${STRICT_TRACE_ID:true}
    type: ${STORAGE_TYPE:mem}
    cassandra:
      contact-points: ${CASSANDRA_CONTACT_POINTS:localhost}
      local-dc: ${CASSANDRA_LOCAL_DC:}
      username: ${CASSANDRA_USERNAME:}
      password: ${CASSANDRA_PASSWORD:}
      keyspace: ${CASSANDRA_KEYSPACE:zipkin}
      max-connections: ${CASSANDRA_MAX_CONNECTIONS:8}
      ensure-schema: ${CASSANDRA_ENSURE_SCHEMA:true}
      span-ttl: ${CASSANDRA_SPAN_TTL:604800}
      index-ttl: ${CASSANDRA_INDEX_TTL:259200}
      index-cache-max: ${CASSANDRA_INDEX_CACHE_MAX:100000}
      index-cache-ttl: ${CASSANDRA_INDEX_CACHE_TTL:60}
      index-fetch-multiplier: ${CASSANDRA_INDEX_FETCH_MULTIPLIER:3}
      use-ssl: ${CASSANDRA_USE_SSL:false}
    cassandra3:
      contact-points: ${CASSANDRA3_CONTACT_POINTS:localhost}
      local-dc: ${CASSANDRA3_LOCAL_DC:}
      username: ${CASSANDRA3_USERNAME:}
      password: ${CASSANDRA3_PASSWORD:}
      keyspace: ${CASSANDRA3_KEYSPACE:zipkin3}
      max-connections: ${CASSANDRA3_MAX_CONNECTIONS:8}
      ensure-schema: ${CASSANDRA3_ENSURE_SCHEMA:true}
      index-fetch-multiplier: ${CASSANDRA3_INDEX_FETCH_MULTIPLIER:3}
      use-ssl: ${CASSANDRA3_USE_SSL:false}
    elasticsearch:
      hosts: ${ES_HOSTS:}
      pipeline: ${ES_PIPELINE:}
      max-requests: ${ES_MAX_REQUESTS:64}
      aws:
        domain: ${ES_AWS_DOMAIN:}
        region: ${ES_AWS_REGION:}
      index: ${ES_INDEX:zipkin}
      date-separator: ${ES_DATE_SEPARATOR:-}
      index-shards: ${ES_INDEX_SHARDS:5}
      index-replicas: ${ES_INDEX_REPLICAS:1}
    mysql:
      host: ${MYSQL_HOST:localhost}
      port: ${MYSQL_TCP_PORT:3306}
      username: ${MYSQL_USER:}
      password: ${MYSQL_PASS:}
      db: ${MYSQL_DB:zipkin}
      max-active: ${MYSQL_MAX_CONNECTIONS:10}
      use-ssl: ${MYSQL_USE_SSL:false}
  ui:
    query-limit: 10
    environment:
    default-lookback: 3600000
    instrumented: .*

server:
  port: ${QUERY_PORT:9411}
  compression:
    enabled: true
    mime-types: application/json,application/javascript,text/css,image/svg

spring:
  mvc:
    favicon:
      enabled: false
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

info:
  zipkin:
    version: "1.21.1-SNAPSHOT"

logging:
  level:
    com.facebook.swift.service.ThriftServiceProcessor: 'OFF'

    ps:可以看到配置文件组织还是很清晰的,可以直接修改这个文件,再重新打包,或者直接在命令行指定配置文件

启动

java -DKAFKA_ZOOKEEPER=localhost:2181 -DSTORAGE_TYPE=elasticsearch -jar zipkin-server-*-exec.jar

   ps:在java -jar启动的时候添加 -Dxxx进行配置,最好把启动命令封装成一个脚本

 

 

展开阅读全文
打赏
0
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部