1

我正在使用以下 Kafka 容器(作为 docker-compose.yml 的一部分)

  broker:
    image: confluentinc/cp-kafka:6.0.1
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "29092:29092"
      - "9092:9092"
      - "9101:9101"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_JMX_PORT: 9101
      KAFKA_JMX_HOSTNAME: localhost
      EXTRA_ARGS: '-javaagent:/usr/share/jmx-exporter/jmx_prometheus_javaagent-0.15.0.jar=7101:/etc/jmx-exporter/config.yml'
    volumes:
      - ./kafka/data:/var/lib/kafka/data
      - ./jmx-exporter/kafka-2_0_0.yml:/etc/jmx_exporter/config.yml
      - ./jmx-exporter/jar:/usr/share/jmx_exporter/

Jmx 导出器导致容器崩溃,以下是日志:

===> Launching ... 
===> Launching kafka ... 
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : /usr/share/jmx-exporter/jmx_prometheus_javaagent-0.15.0.jar
agent library failed to init: instrument

我验证了 jmx 导出器 jar,它的配置在容器内可用。

jmx_prometheus_javaagent-0.15.0.jar 已从此处下载:github.com/prometheus/jmx_exporter

有任何想法吗?

4

1 回答 1

0
/usr/share/jmx-exporter/jmx_prometheus_javaagent-0.15.0.jar=7101:/etc/jmx-exporter/config.yml'

在这里,7101 表示端口。根据this hmx端口是7101,但在后面的配置中你提到端口是9101。

尝试改变它。我希望它是有帮助的。

于 2021-10-11T07:30:28.843 回答