compose

tquggr8v  于 2021-06-04  发布在  Kafka
关注(0)|答案(2)|浏览(488)

我只能找到将opentracing/jaeger与kafka结合使用的古老而不完整的例子。我想在本地运行一个示例作为概念证明—opentracing跨越到kafka。
我设法让一些工作,但 jeager-query 我一直得到的服务:

"msg":"Failed to init storage factory","error":"kafka: client has run out of available brokers to talk to (Is your cluster reachable?)"

我不确定我是否需要使用某种存储,比如Cassandra?

version: '3.8'

services:

  zookeeper:
    image: confluentinc/cp-zookeeper
    networks:
      - kafka-net
    container_name: zookeeper
    environment:
        - ZOOKEEPER_CLIENT_PORT=2181
    ports:
        - 2181:2181

  kafka:
    image: confluentinc/cp-kafka
    networks:
      - kafka-net
    container_name: kafka
    environment:
        - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
        - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
        - ALLOW_PLAINTEXT_LISTENER=yes
        - KAFKA_LISTENERS-INTERNAL://kafka:29092,EXTERNAL://localhost:9092
        - KAFKA_ADVERTISED=INTERNAL://kafka:29092,EXTERNAL://localhost:9092
        - KAFKA_ADVERTISED_LISTENERS=INTERNAL://kafka:29092,EXTERNAL://localhost:9092
        - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
        - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL
    ports:
        - 9092:9092
    depends_on:
        - zookeeper
    restart: on-failure

  jaeger-collector:
    image: jaegertracing/jaeger-collector
    container_name: jaeger-collector
    networks:
      - kafka-net
    ports:
      - "14250:14250"
      # - "14267:14267"
      - "14268:14268" # HTTP collector port to receive spans
      - "14269:14269" # HTTP health check port
    restart: on-failure
    environment:
      LOG_LEVEL: "debug"
      SPAN_STORAGE_TYPE: "kafka"
      KAFKA_TOPIC: "somekafkatag"
      KAFKA_BROKERS: "kafka:9092"
      KAFKA_PRODUCER_BROKERS: "kafka:29092"

  jaeger-agent:
    image: jaegertracing/jaeger-agent
    container_name: jaeger-agent
    networks:
      - kafka-net
    command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
    ports:
      - "5775:5775/udp"
      - "6831:6831/udp"
      - "6832:6832/udp"
      - "5778:5778"
    environment:
      LOG_LEVEL: "debug"
      SPAN_STORAGE_TYPE: "kafka"
    restart: on-failure
    depends_on:
      - jaeger-collector

  jaeger-ingester:
    image: jaegertracing/jaeger-ingester
    container_name: jaeger-ingester
    networks:
      - kafka-net
    ports:
      - "14270:14270" # HTTP health check port: http://localhost:14270/
      - "14271:14271" # Metrics port: http://localhost:14271/metrics
    restart: on-failure
    command: ["--kafka.producer.brokers=kafka:9092"]
    environment:
      LOG_LEVEL: "debug"
      INGESTER_PARALLELISM: "1"
      INGESTER_DEADLOCKINTERVAL: "0ms"
      SPAN_STORAGE_TYPE: "kafka"
      KAFKA_CONSUMER_BROKERS: "kafka:9092"
      METRICS_BACKEND: "expvar"
      KAFKA_BROKERS: "kafka:29092"

  jaeger-query:
    image: jaegertracing/jaeger-query
    container_name: jaeger-query
    networks:
      - kafka-net
    ports:
      - "16686:16686" # Jaeger UI port
      - "16687:16687" # HTTP health check port: http://localhost:16687/
    restart: on-failure
    environment:
      LOG_LEVEL: "debug"
      SPAN_STORAGE_TYPE: "kafka"
      KAFKA_CONSUMER_BROKERS: "kafka:9092"
      KAFKA_BROKERS: "kafka:29092"

networks:
  kafka-net:
    driver: bridge
raogr8fs

raogr8fs1#

您可以看到jaeger查询配置包括:span\u storage\u type:“kafka”
该错误表示jaeger查询用于在kafka中存储跨距的kafka客户端实际上无法到达kafka,因此jaeger存储工厂无法初始化。
这可能是因为Kafka启动失败(你检查了吗)?或者你的 Docker 对网络的错误配置。

neekobn8

neekobn82#

我错过了很多信息。我设法让它工作:

version: '3.8'

services:

  zookeeper:
    image: confluentinc/cp-zookeeper
    networks:
      - kafka-net
    container_name: zookeeper
    environment:
        ZOOKEEPER_CLIENT_PORT: 2181
    ports:
        - 2181:2181

  cassandra:
    hostname: cassandra
    image: cassandra
    networks:
      - kafka-net
    environment:
      MAX_HEAP_SIZE: 1G
      HEAP_NEWSIZE: 256M
    ports:
     - "9042:9042"

  cassandra-schema:
    image: jaegertracing/jaeger-cassandra-schema
    networks:
      - kafka-net
    depends_on:
      - cassandra

  kafka:
    image: confluentinc/cp-kafka
    networks:
      - kafka-net
    container_name: kafka
    environment:
        KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
        KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
        ALLOW_PLAINTEXT_LISTENER: "yes"
        KAFKA_LISTENERS-INTERNAL: //kafka:29092,EXTERNAL://localhost:9092
        KAFKA_ADVERTISED: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
        KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
        KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
        KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
    ports:
        - 9092:9092
        - 29092:29092
    depends_on:
        - zookeeper
    restart: on-failure

  jaeger-collector:
    image: jaegertracing/jaeger-collector
    container_name: jaeger-collector
    networks:
      - kafka-net
    ports:
      - "14250:14250"
      - "14267:14267"
      - "14268:14268" # HTTP collector port to receive spans
      - "14269:14269" # HTTP health check port
    restart: on-failure
    environment:
      LOG_LEVEL: "debug"
      SPAN_STORAGE_TYPE: "kafka"
      KAFKA_BROKERS: "kafka:9092"
      KAFKA_PRODUCER_BROKERS: "kafka:29092"

  jaeger-agent:
    image: jaegertracing/jaeger-agent
    container_name: jaeger-agent
    networks:
      - kafka-net
    command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
    ports:
      - "5775:5775/udp"
      - "6831:6831/udp"
      - "6832:6832/udp"
      - "5778:5778"
    environment:
      LOG_LEVEL: "debug"
      SPAN_STORAGE_TYPE: "kafka"
    restart: on-failure
    depends_on:
      - jaeger-collector

  jaeger-ingester:
    image: jaegertracing/jaeger-ingester
    container_name: jaeger-ingester
    networks:
      - kafka-net
    ports:
      - "14270:14270" # HTTP health check port: http://localhost:14270/
      - "14271:14271" # Metrics port: http://localhost:14270/metrics
    restart: on-failure
    environment:
      LOG_LEVEL: debug
      INGESTER_PARALLELISM: 1
      INGESTER_DEADLOCKINTERVAL: ms
      SPAN_STORAGE_TYPE: cassandra
      CASSANDRA_SERVERS: cassandra
      CASSANDRA_KEYSPACE: jaeger_v1_dc1
      METRICS_BACKEND: expvar
      KAFKA_CONSUMER_BROKERS: kafka:29092
      KAFKA_CONSUMER_TOPIC: jaeger-spans
    depends_on:
      - cassandra-schema

  jaeger-query:
    image: jaegertracing/jaeger-query
    container_name: jaeger-query
    networks:
      - kafka-net
    ports:
      - "16686:16686" # Jaeger UI port
      - "16687:16687" # HTTP health check port: http://localhost:16687/
    restart: on-failure
    depends_on:
      - cassandra-schema
    environment:
      LOG_LEVEL: debug
      SPAN_STORAGE_TYPE: cassandra
      CASSANDRA_SERVERS: cassandra
      CASSANDRA_KEYSPACE: jaeger_v1_dc1
      JAEGER_ENDPOINT: http://jaeger-collector:14268/api/traces

networks:
  kafka-net:
    driver: bridge

相关问题