添加jmx\ujavaagent后,在kubernetes中列出kafka主题失败

anhgbhbe  于 2021-06-07  发布在  Kafka
关注(0)|答案(2)|浏览(384)

我的Kubernetes星系群里有一个正在运行的Kafka吊舱。为了获得prometheus格式的定制度量,我配置了一个jmx\uprometheus\ujavaagent并设计了2255端口。我可以列出localhost:2255/metrics.
问题是,在这之后,我无法列出Kafka的主题。获取以下错误:

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

中止(堆芯转储)
你知道怎么解决这个错误吗?

s3fp2yjn

s3fp2yjn1#

使用“docker ps”获取kafka broker容器id
然后从命令行对该容器运行kafka命令,方法如下:
docker exec-it containerid/bin/bash-c“kafka\u opts=&&kafka主题--zookeeper 127.0.0.1:2181--list”
更改containerid和zookeeper地址以适合您的环境。

new9mtju

new9mtju2#

您已经对它进行了设置,这样不仅可以为kafka服务器加载java代理,还可以加载所有命令行工具。您应该更改配置,以便只为服务器加载配置。

相关问题