kafka command raise 'Address Already in used' after configuration
vhp1360 opened this issue · comments
Hello
I face a issue.
I config my kafka cluster according documentation and I can gather metrics in premetheus, but after changing kafka-server-class.sh
file according the this project documentation, I couldn't run any kafka commands and I got Address Already in used
. this error raise for any ports which I set for java -javaagent:./jmx_prometheus_javaagent-0.20.0.jar=AnyPort:config.yaml -jar yourJar.jar
@vhp1360 for Kafka, you should integrate the JMX exporter at the component level.
For a broker, you should add it to KAFKA_OPTS
. Typically this is the configuration in the broker's systemd file.
Other components follow a similar scenario, but may use different environment variable names.
thanks for reply, could you please provide a link.
I'm doing according this document.
Here is a good reference: https://www.confluent.io/blog/monitor-kafka-clusters-with-prometheus-grafana-and-confluent/
thank you, i'm checking in next days and reply.
hello again.
I'm using Apache Kafka pre-build files.
I meant for example I run ~/kafka/bin/kafka-server-start.sh ~/kafka/config/server.1.properties
to run kafka.
so, which file, should I add -javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.15.0.jar=1234:/opt/prometheus/kafka_broker.yml'? as I told I added in
kafka/bin/kafka-run-class.sh`
I couldn't find my question in the provided link. It assumes we use the installed version.
thanks
"You can inject it by appending the KAFKA_OPTS variable or by adding an EXTRA_ARGS (variable)"
Define an environment variable EXTRA_ARGS
...
export EXTRA_ARGS="-javaagent:/opt/prometheus/jmx_prometheus_javaagent.0.15.0.jar=1234:/opt/prometheus/kafka_broker.yml"
When you run ...
~/kafka/bin/kafka-server-start.sh ~/kafka/config/server.1.properties`
... the extras args will be added to the overall command.