简体   繁体   English

添加jmx__javaagent后无法在kubernetes中列出kafka主题

[英]Failed to list kafka topics in kubernetes after adding jmx__javaagent

I have a running kafka pod in my kubernetes cluster.我的 kubernetes 集群中有一个正在运行的 kafka pod。 For getting custom metrics in prometheus format, I have configured a jmx_prometheus_javaagent and assagined the port 2255. And I am able to list the metrics from localhost:2255/metrics.为了以 prometheus 格式获取自定义指标,我配置了一个 jmx_prometheus_javaagent 并设置了端口 2255。我可以从 localhost:2255/metrics 列出指标。

The issue is, after this, I am not able to list the kafka topics.问题是,在此之后,我无法列出 kafka 主题。 Getting following error:得到以下错误:


bash-4.3# /opt/kafka/bin/kafka-topics.sh --list --zookeeper dz-zookeeper:2181

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.bind(ServerImpl.java:133)
at sun.net.httpserver.HttpServerImpl.bind(HttpServerImpl.java:54)
at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer.<init>(HTTPServer.java:145)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:49)
FATAL ERROR in native method: processing of -javaagent failed

Aborted (core dumped)中止(核心转储)


Any idea, how to solve this error?任何想法,如何解决这个错误?

You've set it up so that the java agent is being loaded not just for the kafka server, but also all of the command line tools.您已经对其进行了设置,以便不仅为 kafka 服务器加载 java 代理,还为所有命令行工具加载。 You should change your configuration so it is only being loaded for the server.您应该更改配置,以便仅为服务器加载它。

Get the kafka broker container ID by using "docker ps"使用“docker ps”获取 kafka 代理容器 ID

Then run the kafka command against that container from the command line this way:然后以这种方式从命令行针对该容器运行 kafka 命令:

docker exec -it CONTAINERID /bin/bash -c "KAFKA_OPTS= && kafka-topics --zookeeper 127.0.0.1:2181 --list" docker exec -it CONTAINERID /bin/bash -c "KAFKA_OPTS= && kafka-topics --zookeeper 127.0.0.1:2181 --list"

Change the CONTAINERID and the zookeeper address to fit your enviroment.更改 CONTAINERID 和 zookeeper 地址以适合您的环境。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建主题,但在Kubernetes上使用Python获得Kafka FailedPayloadsError - Creating topics, but getting Kafka FailedPayloadsError with Python on Kubernetes Kubernetes 上的 Kafka 使用 Strimzi:监控/向普罗米修斯公开所有 JMX 指标 - Kafka on Kubernetes using Strimzi : monitoring/exposing all JMX metrics to prometheus kafka on kubernetes无法生成/使用主题(ClosedChannelException,ErrorLoggingCallback) - kafka on kubernetes cannot produce/consume topics (ClosedChannelException, ErrorLoggingCallback) 无法阅读 kafka 消息,但可以列出可用主题 - unable to read kafka messages but can list the available topics 在 Kafka 上出现错误,因为消费者无法从主题中读取 - /10.2.***.* 的身份验证失败(SSL 握手失败) - Getting error on Kafka as and consumer is not able to read from topics — Failed authentication with /10.2.***.* (SSL handshake failed) kafka 消费者问题:创建消费者后连接断开:Kafka + kubernetes - kafka consumer issue: connection drop after consumer is created: Kafka + kubernetes 在kubernetes上构建kafka集群后,如何公开kafka供外部访问? - How to expose kafka for external access after build kafka cluster on kubernetes? Kubernetes:服务器停止后 Kafka pod 关闭 - Kubernetes: Kafka pod shutdown after server stops Kubernetes 上的 Kafka 流:重新部署后的长时间重新平衡 - Kafka Streams on Kubernetes: Long rebalancing after redeployment Kafka Producer jmx 指标缺失 - Kafka Producer jmx metrics missing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM