jaeger 使用ElasticSearch 做爲後端存儲

jaeger 支持es 做爲後端存儲,這樣對於查詢、以及系統擴展是比較方便的node

使用docker-compose 運行nginx

環境準備

參考項目: https://github.com/rongfengliang/nginx-opentracing-demogit

  • docker-compose file
version: '3'
services:
  nginx:
    image: opentracing/nginx-opentracing
    networks:
      trivial_example:
        aliases:
          - nginx
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./jaeger-config.json:/etc/jaeger-config.json
    expose:
      - "8080"
    ports:
      - "8080:8080"
  elasticsearch:
   image: elasticsearch:5.6.12
   ulimits:
      memlock:
        soft: -1
        hard: -1
   ports:
    - 9200:9200
   volumes:
    - ./es-data:/usr/share/elasticsearch/data
   environment:
    - transport.host=0.0.0.0
    - http.cors.enabled=true
    - http.cors.allow-origin="*"
    - discovery.zen.minimum_master_nodes=1
   networks:
    trivial_example:
     aliases:
      - elasticsearch
  app-service:
    build:
      context: .
      dockerfile: ./Dockerfile
    networks:
      trivial_example:
        aliases:
          - app-service
    expose:
      - "9001"
    ports:
      - "9001:9001"
    command:
      - /app/server
      - -collector_host
      - jaeger
  deps:
    image: jaegertracing/spark-dependencies
    environment:
     - STORAGE=elasticsearch
     - ES_NODES=http://elasticsearch:9200
    networks:
      trivial_example:
        aliases:
          - deps
  jaeger:
    image: jaegertracing/all-in-one:1.7
    environment:
      - COLLECTOR_ZIPKIN_HTTP_PORT=9411
      - ES_SERVER_URLS=http://elasticsearch:9200
      - SPAN_STORAGE_TYPE=elasticsearch
      - ES_TAGS_AS_FIELDS=true
    networks:
      trivial_example:
        aliases:
          - jaeger
    expose:
      - "9411"
      - "16686"
    ports:
      - "9411:9411"
      - "16686:16686"
networks:
  trivial_example: {}
  • 說明
    主要是經過環境變量指定存儲類型以及es 服務器集羣的地址,注意對於依賴關係須要有一個單獨的服務

啓動&&測試

  • 啓動
docker-compose up -d
  • 效果



說明

關於依賴的顯示,須要使用spark-dependencies處理,參考docker-compose file
同時須要配置爲定時任務github

參考資料

https://www.jaegertracing.io/docs/1.7/architecture/
https://www.jaegertracing.io/docs/1.7/deployment/
https://github.com/rongfengliang/nginx-opentracing-demo
https://github.com/jaegertracing/jaeger/blob/master/plugin/storage/es/README.md
https://hub.docker.com/r/jaegertracing/spark-dependencies/
http://www.javashuo.com/article/p-vztadsrj-gv.htmldocker

相關文章
相關標籤/搜索